diff options
author | Sebastian Kügler <sebas@kde.org> | 2015-11-29 18:56:21 +0100 |
---|---|---|
committer | Sebastian Kügler <sebas@kde.org> | 2015-11-29 18:57:50 +0100 |
commit | 5e5c9830a48e8f9c0a376863b4fa17c7f5056af3 (patch) | |
tree | 2f2c8f89ce8c3cecad6b9f4279d94106b5cbe41d /qt-mobile | |
parent | 6ffef818a8d34fdc8aef70c3515c2b91d8d297ac (diff) | |
download | subsurface-5e5c9830a48e8f9c0a376863b4fa17c7f5056af3.tar.gz |
Sync with upstream mobilecomponents
This updates to the state of bf7914b67c45e
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qml/mobilecomponents/Page.qml | 4 | ||||
-rw-r--r-- | qt-mobile/qml/mobilecomponents/PageRow.qml | 11 | ||||
-rw-r--r-- | qt-mobile/qml/mobilecomponents/Units.qml | 2 | ||||
-rw-r--r-- | qt-mobile/qml/mobilecomponents/private/ActionButton.qml | 12 |
4 files changed, 20 insertions, 9 deletions
diff --git a/qt-mobile/qml/mobilecomponents/Page.qml b/qt-mobile/qml/mobilecomponents/Page.qml index 53cb04e2a..43ec43a49 100644 --- a/qt-mobile/qml/mobilecomponents/Page.qml +++ b/qt-mobile/qml/mobilecomponents/Page.qml @@ -59,10 +59,6 @@ Rectangle { target: flickable property real oldContentY: flickable.contentY onContentYChanged: { - print(flickable.contentY+" "+actionButton.transform[0] ) - if (flickable.atYBeginning || flickable.atYEnd) { - return; - } actionButton.transform[0].y = Math.min(actionButton.height, Math.max(0, actionButton.transform[0].y + (flickable.contentY - oldContentY))); oldContentY = flickable.contentY; diff --git a/qt-mobile/qml/mobilecomponents/PageRow.qml b/qt-mobile/qml/mobilecomponents/PageRow.qml index 941f77f73..4d6adf5a7 100644 --- a/qt-mobile/qml/mobilecomponents/PageRow.qml +++ b/qt-mobile/qml/mobilecomponents/PageRow.qml @@ -82,6 +82,7 @@ Item { // Returns the page instance. function push(page, properties, immediate) { + scrollAnimation.running = false; var item = Engine.push(page, properties, false, immediate) scrollToLevel(depth) return item @@ -93,6 +94,7 @@ Item { // Returns the page instance that was popped off the stack. function pop(page, immediate) { + scrollToLevel(depth-1); return Engine.pop(page, immediate); } @@ -100,6 +102,7 @@ Item { // See push() for details. function replace(page, properties, immediate) { + scrollAnimation.running = false; var item = Engine.push(page, properties, true, immediate); scrollToLevel(depth) return item @@ -128,8 +131,8 @@ Item { } var firstLevel = Math.max(0, level - mainFlickable.width/columnWidth + 1); - scrollAnimation.to = Math.max(0, Math.min(Math.max(0, columnWidth * (firstLevel - 1)), mainFlickable.contentWidth+1000)) - scrollAnimation.running = true + scrollAnimation.to = Math.max(0, Math.min(Math.max(0, columnWidth * (firstLevel - 1)), mainFlickable.contentWidth)); + scrollAnimation.running = true; } SequentialAnimation { @@ -173,6 +176,10 @@ Item { } } + onWidthChanged: { + var firstLevel = Math.max(0, depth - mainFlickable.width/columnWidth + 1); + mainFlickable.contentX = Math.max(0, Math.min(Math.max(0, columnWidth * (firstLevel - 1)), mainFlickable.contentWidth)); + } Component.onCompleted: { internal.completed = true if (initialPage && depth == 0) diff --git a/qt-mobile/qml/mobilecomponents/Units.qml b/qt-mobile/qml/mobilecomponents/Units.qml index 971336301..8b5032a71 100644 --- a/qt-mobile/qml/mobilecomponents/Units.qml +++ b/qt-mobile/qml/mobilecomponents/Units.qml @@ -81,7 +81,7 @@ QtObject { * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. */ - property real devicePixelRatio: Screen.devicePixelRatio + property real devicePixelRatio: fontMetrics.height / fontMetrics.font.pointSize /** * units.longDuration should be used for longer, screen-covering animations, for opening and diff --git a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml index 5bf6ab086..bfc8c5875 100644 --- a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml +++ b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml @@ -73,10 +73,18 @@ MouseArea { } } } + Connections { + target: button.parent + onWidthChanged: button.x = button.parent.width/2 - button.width/2 + } onXChanged: { if (button.pressed) { - globalDrawer.position = Math.min(1, Math.max(0, (x - button.parent.width/2 + button.width/2)/globalDrawer.contentItem.width)); - contextDrawer.position = Math.min(1, Math.max(0, (button.parent.width/2 - button.width/2 - x)/contextDrawer.contentItem.width)); + if (globalDrawer) { + globalDrawer.position = Math.min(1, Math.max(0, (x - button.parent.width/2 + button.width/2)/globalDrawer.contentItem.width)); + } + if (contextDrawer) { + contextDrawer.position = Math.min(1, Math.max(0, (button.parent.width/2 - button.width/2 - x)/contextDrawer.contentItem.width)); + } } } |