[PyQt] [PYQT]Search in QTextedit
Maziar Parsijani
maziar.parsijani at gmail.com
Sun Aug 19 18:04:00 BST 2018
Florian
I used This
self.SearchResults.find(self.lineEdit.text(),QTextDocument.FindBackward)
But as I said I have to find all items one by one.I want to find them
all at once.
On Sun, Aug 19, 2018 at 8:58 PM, Maziar Parsijani <
maziar.parsijani at gmail.com> wrote:
> For more Info I have to say that I first find what I want with below code in sqlite.after that I use the other code with regix to highlight results.
>
> and another reason is that its gonna be faster.And I can not count results in sqlite if there are more that on results in a row.
>
>
> with conn:
> cur = conn.cursor()
> conn.text_factory = str
>
> qury = (" SELECT * FROM Translation WHERE table LIKE '%{0}%';").format(self.lineEdit.text())
> cur.execute(qury)
> self.all_rows = cur.fetchall()
> a = 1
> for row in self.all_rows:
> self.SearchResults.append('{0} )- {1} ﴿ {2}:mjp ={3} ﴾'.format(a, row[4], row[2], row[1]))
> self.SearchResults.append('{0} '.format((row[3])))
> self.SearchResults.append("")
> a = a + 1
>
>
> On Sun, Aug 19, 2018 at 8:49 PM, Maziar Parsijani <
> maziar.parsijani at gmail.com> wrote:
>
>> Yes thats not help full because it is important for me to foreground the
>> results all together. For example: "Hello world"is my text when I want to
>> search "l"I want it to be highlighted .I couldn't do that with
>> QTextEdit::find.
>>
>> On Sun, Aug 19, 2018 at 8:34 PM, Florian Bruhin <me at the-compiler.org>
>> wrote:
>>
>>> On Sun, Aug 19, 2018 at 08:31:13PM +0430, Maziar Parsijani wrote:
>>> > I use the below code to search in qtextedit to match a word.Are there
>>> any
>>> > better Idea.
>>>
>>> Are you aware that there's a QTextEdit::find method?
>>>
>>> Florian
>>>
>>> --
>>> https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
>>> GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
>>> I love long mails! | https://email.is-not-s.ms/
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180819/2daa91f7/attachment-0001.html>
More information about the PyQt
mailing list