allow last column to be bigger

last column wisth is regulated by the page's implicitWidth, but the
final with will always be a multiple of columnWidth
This commit is contained in:
Marco Martin 2013-05-15 14:16:44 +02:00
parent e4739a9aad
commit e07cbe99af

View File

@ -98,7 +98,9 @@ Item {
// See push() for details. // See push() for details.
function replace(page, properties, immediate) function replace(page, properties, immediate)
{ {
return Engine.push(page, properties, true, immediate); var item = Engine.push(page, properties, true, immediate);
scrollToLevel(depth)
return item
} }
// Clears the page stack. // Clears the page stack.
@ -207,7 +209,7 @@ Item {
Row { Row {
id: root id: root
spacing: -100 spacing: -100
width: columnWidth*depth width: childrenRect.width - 100
height: parent.height height: parent.height
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {
@ -252,7 +254,8 @@ Item {
Item { Item {
id: container id: container
width: columnWidth + 100 implicitWidth: actualContainer.width + 100
width: implicitWidth
height: parent ? parent.height : 0 height: parent ? parent.height : 0
x: 0 x: 0
@ -305,7 +308,7 @@ Item {
right: parent.right right: parent.right
rightMargin: 100 rightMargin: 100
} }
width: columnWidth width: (container.pageDepth >= actualRoot.depth ? Math.min(actualRoot.width, Math.max(1, Math.round(page.implicitWidth/columnWidth))*columnWidth) : columnWidth)
} }
Image { Image {
@ -430,7 +433,7 @@ Item {
State { State {
name: "" name: ""
PropertyChanges { target: container; visible: true; opacity: 1 } PropertyChanges { target: container; visible: true; opacity: 1 }
PropertyChanges { target: container; width: columnWidth+100} PropertyChanges { target: container; width: container.implicitWidth}
}, },
// Start state for pop entry, end state for push exit. // Start state for pop entry, end state for push exit.
State { State {
@ -448,7 +451,7 @@ Item {
State { State {
name: "Hidden" name: "Hidden"
PropertyChanges { target: container; visible: false } PropertyChanges { target: container; visible: false }
PropertyChanges { target: container; width: columnWidth+100} PropertyChanges { target: container; width: container.implicitWidth}
} }
] ]