summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJari Tenhunen <jari.tenhunen@iki.fi>2014-10-05 19:49:39 +0300
committerJari Tenhunen <jari.tenhunen@iki.fi>2014-10-07 13:35:51 +0200
commit7d70583589aee971c7adf101edc8bb4b6f0066aa (patch)
treeaa3d64fb4ea749fd19bcc9fca38638de9e2488ef /src/gui
parent3ab084b95d7b6f751473e43b4641e3b5deda2dfa (diff)
QMacStyle: Fix QTabBar appearance on Yosemite
The selected tab text color should be white except when the window is not active. Also, no text shadow should be rendered in any case. Finally, there's no need to move the tab shape up anymore. Backport of qtbase/e9e66079b16754f1fef89c2ad93593d7d55c8654 Change-Id: Ib41b9ccb990dc5c550f5a48c855bebd39262b06e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/styles/qmacstyle_mac.mm29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index ff3696c39c..2dded75802 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -3544,6 +3544,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
return;
}
}
+
+ bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9;
+
HIThemeTabDrawInfo tdi;
tdi.version = 1;
tdi.style = kThemeTabNonFront;
@@ -3584,10 +3587,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
else
tdi.adornment = kHIThemeTabAdornmentNone;
tdi.kind = kHIThemeTabKindNormal;
- if (!verticalTabs)
- tabRect.setY(tabRect.y() - 1);
- else
- tabRect.setX(tabRect.x() - 1);
+
+ if (!usingYosemiteOrLater) {
+ if (!verticalTabs)
+ tabRect.setY(tabRect.y() - 1);
+ else
+ tabRect.setX(tabRect.x() - 1);
+ }
QStyleOptionTab::TabPosition tp = tabOpt->position;
QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition;
if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) {
@@ -3652,18 +3658,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
ThemeTabDirection ttd = getTabDirection(myTab.shape);
bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
bool selected = (myTab.state & QStyle::State_Selected);
- bool usingModernOSX = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6;
+ bool usingLionOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6;
+ bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9;
- if (usingModernOSX && selected && !myTab.documentMode)
- myTab.palette.setColor(QPalette::WindowText, QColor(Qt::white));
+ if (usingLionOrLater && 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
// their own fault).
bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem");
- if ((usingModernOSX && selected) || verticalTabs || nonDefaultFont || !tab->icon.isNull()
- || !myTab.leftButtonSize.isNull() || !myTab.rightButtonSize.isNull()) {
+ bool isSelectedAndNeedsShadow = selected && usingLionOrLater && !usingYosemiteOrLater;
+ if (isSelectedAndNeedsShadow || verticalTabs || nonDefaultFont || !tab->icon.isNull()
+ || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) {
int heightOffset = 0;
if (verticalTabs) {
heightOffset = -1;
@@ -3673,7 +3682,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
myTab.rect.setHeight(myTab.rect.height() + heightOffset);
- if (myTab.documentMode || (usingModernOSX && selected)) {
+ if (myTab.documentMode || isSelectedAndNeedsShadow) {
p->save();
rotateTabPainter(p, myTab.shape, myTab.rect);