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; ret = false;
break; break;
case SH_ScrollBar_Transient: case SH_ScrollBar_Transient:
if (!qobject_cast<const QScrollBar*>(w)) { if ((qobject_cast<const QScrollBar *>(w) && w->parent() &&
ret = false; qobject_cast<QAbstractScrollArea*>(w->parent()->parent())) ||
break; (opt && QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ScrollBar))) {
} ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7;
ret = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) if (ret)
ret &= [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay; ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay;
#endif #endif
}
break; break;
default: default:
ret = QCommonStyle::styleHint(sh, opt, w, hret); ret = QCommonStyle::styleHint(sh, opt, w, hret);