Mac: Fix transient scroll bar appearance.

Transient scroll bars should never be used outside of scroll areas,
since they would be unusable.

Task-Number: QTBUG-29389

Change-Id: Ie52d2093a4ab66085300a19ca9a1b32f13a29e79
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Christoph Schleifenbaum 2013-02-07 13:07:31 +01:00 committed by The Qt Project
parent d061cfde88
commit 44f6dcf054

View File

@ -2707,15 +2707,15 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = false;
break;
case SH_ScrollBar_Transient:
if (!qobject_cast<const QScrollBar*>(w)) {
ret = false;
break;
}
ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7;
if ((qobject_cast<const QScrollBar *>(w) && w->parent() &&
qobject_cast<QAbstractScrollArea*>(w->parent()->parent())) ||
(opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))) {
ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7)
ret &= [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
if (ret)
ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
#endif
}
break;
default:
ret = QCommonStyle::styleHint(sh, opt, w, hret);