Sync with upstream mobilecomponents

This updates to the state of bf7914b67c45e

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2015-11-29 18:56:21 +01:00
parent 6ffef818a8
commit 5e5c9830a4
4 changed files with 20 additions and 9 deletions

View file

@ -59,10 +59,6 @@ Rectangle {
target: flickable target: flickable
property real oldContentY: flickable.contentY property real oldContentY: flickable.contentY
onContentYChanged: { 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))); actionButton.transform[0].y = Math.min(actionButton.height, Math.max(0, actionButton.transform[0].y + (flickable.contentY - oldContentY)));
oldContentY = flickable.contentY; oldContentY = flickable.contentY;

View file

@ -82,6 +82,7 @@ Item {
// Returns the page instance. // Returns the page instance.
function push(page, properties, immediate) function push(page, properties, immediate)
{ {
scrollAnimation.running = false;
var item = Engine.push(page, properties, false, immediate) var item = Engine.push(page, properties, false, immediate)
scrollToLevel(depth) scrollToLevel(depth)
return item return item
@ -93,6 +94,7 @@ Item {
// Returns the page instance that was popped off the stack. // Returns the page instance that was popped off the stack.
function pop(page, immediate) function pop(page, immediate)
{ {
scrollToLevel(depth-1);
return Engine.pop(page, immediate); return Engine.pop(page, immediate);
} }
@ -100,6 +102,7 @@ Item {
// See push() for details. // See push() for details.
function replace(page, properties, immediate) function replace(page, properties, immediate)
{ {
scrollAnimation.running = false;
var item = Engine.push(page, properties, true, immediate); var item = Engine.push(page, properties, true, immediate);
scrollToLevel(depth) scrollToLevel(depth)
return item return item
@ -128,8 +131,8 @@ Item {
} }
var firstLevel = Math.max(0, level - mainFlickable.width/columnWidth + 1); 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.to = Math.max(0, Math.min(Math.max(0, columnWidth * (firstLevel - 1)), mainFlickable.contentWidth));
scrollAnimation.running = true scrollAnimation.running = true;
} }
SequentialAnimation { 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: { Component.onCompleted: {
internal.completed = true internal.completed = true
if (initialPage && depth == 0) if (initialPage && depth == 0)

View file

@ -81,7 +81,7 @@ QtObject {
* use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing.
* The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. * 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 * units.longDuration should be used for longer, screen-covering animations, for opening and

View file

@ -73,10 +73,18 @@ MouseArea {
} }
} }
} }
Connections {
target: button.parent
onWidthChanged: button.x = button.parent.width/2 - button.width/2
}
onXChanged: { onXChanged: {
if (button.pressed) { if (button.pressed) {
globalDrawer.position = Math.min(1, Math.max(0, (x - button.parent.width/2 + button.width/2)/globalDrawer.contentItem.width)); if (globalDrawer) {
contextDrawer.position = Math.min(1, Math.max(0, (button.parent.width/2 - button.width/2 - x)/contextDrawer.contentItem.width)); 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));
}
} }
} }