summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-27 13:01:58 (GMT)
committerPrasanth Ullattil <prasanth.ulattil@nokia.com>2009-10-27 13:01:58 (GMT)
commit124df35db0be3ae7578635735b4e64c589d07cba (patch)
tree8edbb85742efdfbd4f26f1becf3ffb540a77e026
parent3bc088fad760bd50eec05b323a056641247a9a59 (diff)
downloadQt-124df35db0be3ae7578635735b4e64c589d07cba.zip
Qt-124df35db0be3ae7578635735b4e64c589d07cba.tar.gz
Qt-124df35db0be3ae7578635735b4e64c589d07cba.tar.bz2
Selected tab is drawn incorrectly on Snow Leopard.
The default height of tab bar is 22 pixels in Snow Leopard. We used to draw tabs taller than 21 pixels to a pixmap and stretch to the required size. The limit is now changed to 22 pixels (which is the most common use case). The stretched drawing is not perfect in Snow Leopard due to some changes in how HITheme draws tabs. Reviewed-by: Jens Bache-Wiig
-rw-r--r--src/gui/styles/qmacstyle_mac.mm9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 63ba641..4dcb469 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -3637,17 +3637,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
break;
}
}
+ bool stretchTabs = (!verticalTabs && tabRect.height() > 22 || verticalTabs && tabRect.width() > 22);
+
switch (tp) {
case QStyleOptionTab::Beginning:
tdi.position = kHIThemeTabPositionFirst;
- if (sp != QStyleOptionTab::NextIsSelected)
+ if (sp != QStyleOptionTab::NextIsSelected || stretchTabs)
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
break;
case QStyleOptionTab::Middle:
tdi.position = kHIThemeTabPositionMiddle;
if (selected)
tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
- if (sp != QStyleOptionTab::NextIsSelected) // Also when we're selected.
+ if (sp != QStyleOptionTab::NextIsSelected || stretchTabs) // Also when we're selected.
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
break;
case QStyleOptionTab::End:
@@ -3659,9 +3661,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
tdi.position = kHIThemeTabPositionOnly;
break;
}
-
// HITheme doesn't stretch its tabs. Therefore we have to cheat and do the job ourselves.
- if ((!verticalTabs && tabRect.height() > 21 || verticalTabs && tabRect.width() > 21)) {
+ if (stretchTabs) {
HIRect hirect = CGRectMake(0, 0, 23, 23);
QPixmap pm(23, 23);
pm.fill(Qt::transparent);