Respect scrollbar position setting on Mac

This was a regression from Qt 4.7.

[ChangeLog][Widgets][QScrollArea] Respect scrollbar setting for
click-position on Mac.

Task-number: QTBUG-36314
Change-Id: I8bdb1aec9b308b0907f5db29d3519998bc843c18
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
bb10
Jens Bache-Wiig 2014-03-04 17:52:09 +01:00 committed by The Qt Project
parent 80151389d6
commit 23595107cd
3 changed files with 11 additions and 10 deletions

View File

@ -2517,12 +2517,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = 100;
break;
case SH_ScrollBar_LeftClickAbsolutePosition: {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
bool result = [defaults boolForKey:@"AppleScrollerPagingBehavior"];
if(QApplication::keyboardModifiers() & Qt::AltModifier)
ret = false;
//ret = !qt_scrollbar_jump_to_pos;
ret = !result;
else
ret = true;
//ret = qt_scrollbar_jump_to_pos;
ret = result;
break; }
case SH_TabBar_PreferNoArrows:
ret = true;

View File

@ -990,15 +990,12 @@ void tst_QAbstractSlider::sliderPressedReleased()
QRect rect = slider->style()->subControlRect(QStyle::ComplexControl(control), &option,
QStyle::SubControl(subControl), slider);
if (qApp->style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition))
QSKIP("The result depends on system setting on mac");
QTest::mousePress(slider, Qt::LeftButton, 0, QPoint(rect.center().x() + 2, rect.center().y() + 2));
#ifdef Q_OS_MAC
QEXPECT_FAIL("scrollbar on the groove", "QTBUG-23679", Continue);
#endif
QCOMPARE(spy1.count(), expectedCount);
QTest::mouseRelease(slider, Qt::LeftButton, 0, rect.center());
#ifdef Q_OS_MAC
QEXPECT_FAIL("scrollbar on the groove", "QTBUG-23679", Continue);
#endif
QCOMPARE(spy2.count(), expectedCount);
delete slider;

View File

@ -147,6 +147,10 @@ void tst_QScrollBar::task_209492()
QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent);
// Check that the action was triggered once.
#ifdef Q_OS_MAC
QSKIP("The result depends on system setting and is not relevant on Mac");
#endif
QCOMPARE(scrollArea.scrollCount, 1);
QCOMPARE(spy.count(), 1);
}