summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qtabbar.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2016-08-03 14:06:32 +0200
committerAndy Shaw <andy.shaw@qt.io>2016-10-19 15:48:48 +0000
commit2c0033983bc53e906eab3f4b2fae836ff8472713 (patch)
tree923cce9de759e6ad814d8d559a565827817cc72a /src/widgets/widgets/qtabbar.cpp
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 <jake.petroules@qt.io>
Diffstat (limited to 'src/widgets/widgets/qtabbar.cpp')
-rw-r--r--src/widgets/widgets/qtabbar.cpp7
1 files changed, 6 insertions, 1 deletions
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);
+ }
+#endif
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.