Commit c796677a authored by Jens Bache-Wiig's avatar Jens Bache-Wiig Committed by The Qt Project
Browse files

Fix item view selection color


We need to update the active palette text color every time
the state changes.

Change-Id: I7861eb4be76ccaeb58e9ff9aea58fa54d4f8d4c9
Reviewed-by: default avatarGabriel de Dietrich <gabriel.dedietrich@digia.com>
parent dca45226
6.2 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 dev old/5.1 old/5.2 wip/calendar wip/tizen v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1
No related merge requests found
Showing with 13 additions and 6 deletions
......@@ -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);
......
......@@ -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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment