path: root/src/widgets
diff options
authorAndy Shaw <>2016-08-03 14:06:32 +0200
committerAndy Shaw <>2016-10-19 15:48:48 +0000
commit2c0033983bc53e906eab3f4b2fae836ff8472713 (patch)
tree923cce9de759e6ad814d8d559a565827817cc72a /src/widgets
parentcd081ca96a5387abe36f46a347363e07edcdcd67 (diff)
macOS: Don't override the set tab text color with white
Originally on macOS it would override any tab text color with white for the active tab as it would set it directly on the option palette inside the style code. This would cause it to ignore any changes done by the user in a changed option, via setTabTextColor or in a proxy style. Therefore the setting of the color should be done when the style option is initialized and only if the tab text color has not been set by the user. This has the added effect of making it easier to change the color for tabs via a stylesheet since it will not be overridden in the style but setup correctly in the option instead. Change-Id: Ic338e96470112cba71d422bce79e664df0cb188a Reviewed-by: Jake Petroules <>
Diffstat (limited to 'src/widgets')
2 files changed, 6 insertions, 5 deletions
diff --git a/src/widgets/styles/ b/src/widgets/styles/
index 8f724df857..46918a2d5f 100644
--- a/src/widgets/styles/
+++ b/src/widgets/styles/
@@ -4286,10 +4286,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
bool selected = (myTab.state & QStyle::State_Selected);
- if (selected && !myTab.documentMode
- && (!usingYosemiteOrLater || myTab.state & State_Active))
- myTab.palette.setColor(QPalette::WindowText, Qt::white);
// Check to see if we use have the same as the system font
// (QComboMenuItem is internal and should never be seen by the
// outside world, unless they read the source, in which case, it's
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 2a163c18b5..b5ec91f59c 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -170,7 +170,12 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
if (tab.textColor.isValid())
option->palette.setColor(q->foregroundRole(), tab.textColor);
+#ifdef Q_OS_MACOS
+ else if (isCurrent && !documentMode
+ && (QSysInfo::MacintoshVersion < QSysInfo::MV_10_10 || q->isActiveWindow())) {
+ option->palette.setColor(QPalette::WindowText, Qt::white);
+ }
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.