[PyQt] [PYQT5]Highlight search results in qtablewidget(select and highlight that text or character not all of the row or column)

Maziar Parsijani maziar.parsijani at gmail.com
Tue Jul 31 21:04:11 BST 2018


I use method1 to find some text in qtablewidget rows.

method1 :

def FindItem(self):
    items = self.SuraBRS.findItems(
        self.SearchTbox.text(), QtCore.Qt.MatchContains)
    if items:
        results = '\n'.join(
            'row %d column %d' % (item.row() + 1, item.column() + 1)
            for item in items)
    else:
        results = 'Found Nothing'
    print(results)

Now I want to know how to highlight results or change their color.*I want
to select and highlight that text or character not all of the row or column*
.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180801/451bceac/attachment.html>


More information about the PyQt mailing list