fix layouting of dialogs of both formfactors

This commit is contained in:
Marco Martin 2011-11-25 19:59:00 +01:00
parent 41dadc7729
commit 18aadf9e24
3 changed files with 14 additions and 18 deletions

View File

@ -134,8 +134,7 @@ Item {
Item {
id: contentItem
onChildrenRectChanged: mainItem.width = childrenRect.width
clip: true
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
anchors {
top: titleBar.bottom
left: parent.left
@ -153,6 +152,7 @@ Item {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: 4
}
}
}

View File

@ -82,14 +82,14 @@ Dialog {
QtObject {
id: internal
function buttonWidth() {
/*function buttonWidth() {
switch (buttonTexts.length) {
case 0: return 0
case 1: return Math.round((800 - 3 * 4) / 2)
default: return (buttonContainer.width - (buttonTexts.length + 1) *
4) / buttonTexts.length
}
}
}*/
function iconSource() {
return root.titleIcon
@ -145,20 +145,13 @@ Dialog {
}
}
buttons: Item {
id: buttonContainer
buttons: Row {
id: buttonRow
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
width: parent.width
height: buttonTexts.length ? 48 + 2 * 2 : 0
Row {
id: buttonRow
objectName: "buttonRow"
anchors.centerIn: parent
spacing: 4
}
objectName: "buttonRow"
anchors.centerIn: parent
spacing: 4
}
}

View File

@ -112,6 +112,7 @@ Item {
}
mainItem: Item {
id: mainItem
width: theme.defaultFont.mSize.width * 40
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height
@ -133,6 +134,8 @@ Item {
Item {
id: contentItem
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
clip: true
anchors {
top: titleBar.bottom
@ -146,15 +149,15 @@ Item {
id: buttonItem
height: childrenRect.height
clip: true
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: 4
}
}
}
Component.onCompleted: {
rootItem = Utils.rootObject()
}