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>
This commit is contained in:
parent
cd081ca96a
commit
2c0033983b
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user