diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-09-26 15:05:49 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2014-10-03 10:56:14 +0200 |
commit | 0406b19521a69199d2df5d8691c2c55a23309d61 (patch) | |
tree | 4466b9c05efabff0998577e0bf4d202432192432 /src/controls/Styles/iOS | |
parent | 54092aa6bd2859accf344440758bda99a592a51a (diff) | |
download | qtquickcontrols-0406b19521a69199d2df5d8691c2c55a23309d61.tar.gz |
iOS: enhance scrollviewstyle for iOS
Change-Id: Ibead105c519f4ea52284505c13082e2833014573
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/Styles/iOS')
-rw-r--r-- | src/controls/Styles/iOS/ScrollViewStyle.qml | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/src/controls/Styles/iOS/ScrollViewStyle.qml b/src/controls/Styles/iOS/ScrollViewStyle.qml index a8265ede..e96f7e68 100644 --- a/src/controls/Styles/iOS/ScrollViewStyle.qml +++ b/src/controls/Styles/iOS/ScrollViewStyle.qml @@ -37,6 +37,77 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.3 +import QtQuick.Controls.Private 1.0 -ScrollViewStyle { } +ScrollViewStyle { + corner: null + incrementControl: null + decrementControl: null + frame: null + scrollBarBackground: null + padding { top: 0; left: 0; right: 0; bottom: 0 } + + __scrollBarFadeDelay: 50 + __scrollBarFadeDuration: 200 + __stickyScrollbars: true + + handle: Item { + implicitWidth: 2.5 + implicitHeight: 2.5 + + anchors.top: !styleData.horizontal ? parent.top : undefined + anchors.left: styleData.horizontal ? parent.left : undefined + anchors.bottom: parent.bottom + anchors.right: parent.right + + anchors.leftMargin: implicitWidth + anchors.topMargin: implicitHeight + 1 + anchors.rightMargin: implicitWidth * (!styleData.horizontal ? 2 : 4) + anchors.bottomMargin: implicitHeight * (styleData.horizontal ? 2 : 4) + + Behavior on width { enabled: !styleData.horizontal; NumberAnimation { duration: 100 } } + Behavior on height { enabled: styleData.horizontal; NumberAnimation { duration: 100 } } + + Loader { + anchors.fill: parent + sourceComponent: styleData.horizontal ? horzontalHandle : verticalHandle + } + + Component { + id: verticalHandle + Rectangle { + color: "black" + opacity: 0.3 + radius: parent.parent.implicitWidth + width: parent.width + y: overshootBottom > 0 ? parent.height - height : 0 + height: Math.max(8, parent.height - overshootTop - overshootBottom) + + property real overshootTop: -Math.min(0, __control.flickableItem.contentY) + property real overshootBottom: Math.max(0, __control.flickableItem.contentY + - __control.flickableItem.contentHeight + + __control.flickableItem.height) + } + } + + Component { + id: horzontalHandle + Rectangle { + color: "black" + opacity: 0.3 + radius: parent.parent.implicitHeight + height: parent.height + x: overshootRight > 0 ? parent.width - width : 0 + width: Math.max(8, parent.width - overshootLeft - overshootRight) + + property real overshootLeft: -Math.min(0, __control.flickableItem.contentX) + property real overshootRight: Math.max(0, __control.flickableItem.contentX + - __control.flickableItem.contentWidth + + __control.flickableItem.width) + } + } + } +} |