Move HBox stuff from HPopup to BoxPopup

This commit is contained in:
miruka 2019-09-09 12:50:00 -04:00
parent 38781502c6
commit 85bdbcf5be
3 changed files with 32 additions and 31 deletions

View File

@ -6,7 +6,7 @@ Rectangle {
id: interfaceBox
color: theme.controls.box.background
implicitWidth: Math.min(
parent.width, theme.minimumSupportedWidthPlusSpacing * multiplyWidth
window.width, theme.minimumSupportedWidthPlusSpacing * multiplyWidth
)
implicitHeight: childrenRect.height

View File

@ -9,10 +9,6 @@ Popup {
padding: 0
default property alias boxData: box.body
property alias box: box
enter: Transition {
HNumberAnimation { property: "scale"; from: 0; to: 1; overshoot: 4 }
}
@ -24,9 +20,4 @@ Popup {
background: Rectangle {
color: theme.controls.popup.background
}
contentItem: HBox {
id: box
implicitWidth: theme.minimumSupportedWidthPlusSpacing
}
}

View File

@ -11,6 +11,9 @@ HPopup {
signal cancel()
default property alias boxData: box.body
property alias box: box
property alias summary: summary
property alias details: details
property bool okClicked: false
@ -19,14 +22,20 @@ HPopup {
property bool okEnabled: true
box.clickButtonOnEnter: "ok"
box.buttonModel: [
contentItem: HBox {
id: box
clickButtonOnEnter: "ok"
buttonModel: [
{ name: "ok", text: okText, iconName: "ok", enabled: okEnabled},
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
]
box.buttonCallbacks: ({
buttonCallbacks: ({
ok: button => { okClicked = true; popup.ok(); popup.close() },
cancel: button => { okClicked = false; popup.cancel(); popup.close() },
cancel: button => {
okClicked = false; popup.cancel(); popup.close()
},
})
@ -46,4 +55,5 @@ HPopup {
Layout.fillWidth: true
}
}
}