diff options
author | Aleix Pol <aleixpol@kde.org> | 2015-03-30 18:47:52 +0200 |
---|---|---|
committer | Albert Astals Cid <albert.astals@canonical.com> | 2015-05-22 16:40:59 +0000 |
commit | c5c7c2091385e4f6177516e464dcf617d863f2d0 (patch) | |
tree | 74781c7e0f3c1523e7778f6fce48f339b9ad3664 /src | |
parent | 58b8833045f7dc2f5c8c433f9cbbc38e777642ae (diff) | |
download | qtquickcontrols-c5c7c2091385e4f6177516e464dcf617d863f2d0.tar.gz |
Take QApplication::wheelScrollLines into account from ScrollView
Take the property into account, like QtWidgets applications do. This way
the scroll feels more similar to the rest of applications.
Change-Id: Ifde385fbfb052e5d6a446b1e339ce86ae8eca609
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/controls/Private/qquickstyleitem.cpp | 2 | ||||
-rw-r--r-- | src/controls/ScrollView.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Desktop/ScrollViewStyle.qml | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp index 5ddeee16..3cf8ebbe 100644 --- a/src/controls/Private/qquickstyleitem.cpp +++ b/src/controls/Private/qquickstyleitem.cpp @@ -1271,6 +1271,8 @@ QVariant QQuickStyleItem::styleHint(const QString &metric) return qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); else if (metric == "submenupopupdelay") return qApp->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); + else if (metric == "wheelScrollLines") + return qApp->wheelScrollLines(); return 0; // Add SH_Menu_SpaceActivatesItem diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 856a32ef..5c21848f 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -279,6 +279,12 @@ FocusScope { verticalMinimumValue: flickableItem ? flickableItem.originY : 0 verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + // The default scroll speed for typical angle-based mouse wheels. The value + // comes originally from QTextEdit, which sets 20px steps by default, as well as + // QQuickWheelArea. + // TODO: centralize somewhere, QPlatformTheme? + scrollSpeed: 20 * (__style.__wheelScrollLines || 1) + Connections { target: flickableItem diff --git a/src/controls/Styles/Desktop/ScrollViewStyle.qml b/src/controls/Styles/Desktop/ScrollViewStyle.qml index 64de4d56..0ec5788f 100644 --- a/src/controls/Styles/Desktop/ScrollViewStyle.qml +++ b/src/controls/Styles/Desktop/ScrollViewStyle.qml @@ -72,6 +72,8 @@ Style { readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0 + readonly property int __wheelScrollLines: __styleitem.styleHint("wheelScrollLines") + property Component __scrollbar: StyleItem { anchors.fill:parent elementType: "scrollbar" |