diff --git a/src/private/qquickstyleitem.cpp b/src/private/qquickstyleitem.cpp index cfbb36c890a7a87f18311cc0033ba9c93bc39272..422d9a8e5385550942146be3dd08a10949958ee2 100644 --- a/src/private/qquickstyleitem.cpp +++ b/src/private/qquickstyleitem.cpp @@ -938,8 +938,8 @@ QVariant QQuickStyleItem::styleHint(const QString &metric) if (metric == "comboboxpopup") { return qApp->style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption); } else if (metric == "highlightedTextColor") { - QPalette pal = qApp->palette(); - pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive); + QPalette pal = QApplication::palette("QAbstractItemView"); + pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup()); return pal.highlightedText().color().name(); } else if (metric == "textColor") { QPalette pal = qApp->palette(); @@ -1192,8 +1192,11 @@ void QQuickStyleItem::paint(QPainter *painter) pixmap.fill(Qt::transparent); QPainter pixpainter(&pixmap); qApp->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter); - if (!qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected) && selected()) - pixpainter.fillRect(m_styleoption->rect, m_styleoption->palette.highlight()); + if ((style() == "mac" || !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) { + QPalette pal = QApplication::palette("QAbstractItemView"); + pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup()); + pixpainter.fillRect(m_styleoption->rect, pal.highlight()); + } QPixmapCache::insert(pmKey, pixmap); } painter->drawPixmap(0, 0, pixmap); diff --git a/src/styles/Desktop/TableViewStyle.qml b/src/styles/Desktop/TableViewStyle.qml index da6a47e5527d0d5bf7d443513bf1789ec11156b3..52fb963570a84777df9b6266a78b449e618bf10e 100644 --- a/src/styles/Desktop/TableViewStyle.qml +++ b/src/styles/Desktop/TableViewStyle.qml @@ -46,8 +46,8 @@ ScrollViewStyle { readonly property TableView control: __control property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick") - property color textColor: __styleitem.styleHint("textColor") - property color highlightedTextColor: __styleitem.styleHint("highlightedTextColor") + property color textColor: __styleitem.textColor + property color highlightedTextColor: __styleitem.highlightedTextColor property StyleItem __styleitem: StyleItem{ property color textColor: styleHint("textColor") @@ -55,6 +55,10 @@ ScrollViewStyle { elementType: "item" visible: false active: control.activeFocus + onActiveChanged: { + highlightedTextColor = styleHint("highlightedTextColor") + textColor = styleHint("textColor") + } } property Component headerDelegate: StyleItem {