diff --git a/orangecontrib/text/widgets/owtopicmodeling.py b/orangecontrib/text/widgets/owtopicmodeling.py index f1ce69df3..d86330be9 100644 --- a/orangecontrib/text/widgets/owtopicmodeling.py +++ b/orangecontrib/text/widgets/owtopicmodeling.py @@ -9,6 +9,7 @@ QGroupBox, QTreeWidgetItem, QTreeWidget, QStyleOptionViewItem, QStyledItemDelegate, QStyle) from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin +from orangewidget.utils.itemdelegates import text_color_for_state from gensim.models import CoherenceModel @@ -368,7 +369,7 @@ class HTMLDelegate(QStyledItemDelegate): Adopted from https://stackoverflow.com/a/5443112/892987 """ def paint(self, painter, option, index): options = QStyleOptionViewItem(option) - self.initStyleOption(options,index) + self.initStyleOption(options, index) style = QApplication.style() if options.widget is None else options.widget.style() @@ -380,10 +381,8 @@ def paint(self, painter, option, index): ctx = QtGui.QAbstractTextDocumentLayout.PaintContext() - if options.state & QStyle.State_Selected: - ctx.palette.setColor(QtGui.QPalette.Text, - options.palette.color(QtGui.QPalette.Active, - QtGui.QPalette.HighlightedText)) + painter.setPen( + QtGui.QPen(text_color_for_state(option.palette, option.state))) textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options) painter.save() @@ -395,7 +394,7 @@ def paint(self, painter, option, index): def sizeHint(self, option, index): options = QStyleOptionViewItem(option) - self.initStyleOption(options,index) + self.initStyleOption(options, index) doc = QtGui.QTextDocument() doc.setHtml(options.text)