diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-06-23 10:47:23 -0700 |
---|---|---|
committer | Błażej Szczygieł <spaz16@wp.pl> | 2017-06-28 10:34:35 +0000 |
commit | d138a239d27b3f2d3b654b4768f8000bb2a555a1 (patch) | |
tree | 2f18791355e23a9e38a3f39fe13b6257245b2bff /src/widgets | |
parent | 9c9382a85f53756c3c702ef7a999720ae40be5b9 (diff) |
Fix current tab text color on Mac when a proxy style is installed
We move the code forcing white text on the current tab to
QMacStyle. This removes the small encapsulation violation
even though we need to check for the tab text color in the
style and modify the palette.
Amends 2fbc1432025dd478cf9e940e3c2a1952b218c6dc.
Change-Id: If31dc11ae389ee5315e84ab03cf1c08540d81640
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qtabbar.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 8d0fe1196c..cf2929db7e 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4210,6 +4210,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); + + if (!myTab.documentMode && (myTab.state & State_Selected) && (myTab.state & State_Active)) + if (const auto *tabBar = qobject_cast<const QTabBar *>(w)) + if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid()) + myTab.palette.setColor(QPalette::WindowText, Qt::white); + if (verticalTabs || nonDefaultFont || !tab->icon.isNull() || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) { int heightOffset = 0; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 060d1f9a03..4cd9522bfb 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -176,10 +176,6 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) if (tab.textColor.isValid()) option->palette.setColor(q->foregroundRole(), tab.textColor); - else if (q->style()->inherits("QMacStyle") - && isCurrent && !documentMode && q->isActiveWindow()) { - option->palette.setColor(QPalette::WindowText, Qt::white); - } option->icon = tab.icon; option->iconSize = q->iconSize(); // Will get the default value then. |