diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-04-02 11:19:42 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-04-02 11:23:17 (GMT) |
commit | ca582d6cb205461cfcdf448749b46ee654faa5fd (patch) | |
tree | 1228bd1cc9f68f3ea578818bf8a60c8351938f46 /src/gui/styles/qgtkstyle.cpp | |
parent | e008504b5ec34975e34adf3b1a2b7170d0e4dd38 (diff) | |
download | Qt-ca582d6cb205461cfcdf448749b46ee654faa5fd.zip Qt-ca582d6cb205461cfcdf448749b46ee654faa5fd.tar.gz Qt-ca582d6cb205461cfcdf448749b46ee654faa5fd.tar.bz2 |
Improved stylesheet support for setting background and foreground roles
This makes sure that style sheets set both ButtonText and WindowText roles
for all widgets. This fixes among other things the fact that you could not
configure text colors for combo box popups on Mac, Gtk and CleanLooks or
set the background for the whole scrollbar.
Task-number: 160713
Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 582962a..81d7cb8 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -2593,16 +2593,24 @@ void QGtkStyle::drawControl(ControlElement element, opt.rect = vCheckRect; drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); } - painter->drawPixmap(pmr.topLeft(), pixmap); } GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL]; GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE]; GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT]; + uint resolve_mask = option->palette.resolve(); QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8); + if (resolve_mask & (1 << QPalette::ButtonText)) { + textColor = option->palette.buttonText().color(); + disabledTextColor = option->palette.brush(QPalette::Disabled, QPalette::ButtonText);; + } + QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8); + if (resolve_mask & (1 << QPalette::HighlightedText)) { + highlightedTextColor = option->palette.highlightedText().color(); + } if (selected) painter->setPen(highlightedTextColor); |