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 id: interfaceBox
color: theme.controls.box.background color: theme.controls.box.background
implicitWidth: Math.min( implicitWidth: Math.min(
parent.width, theme.minimumSupportedWidthPlusSpacing * multiplyWidth window.width, theme.minimumSupportedWidthPlusSpacing * multiplyWidth
) )
implicitHeight: childrenRect.height implicitHeight: childrenRect.height

View File

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

View File

@ -11,6 +11,9 @@ HPopup {
signal cancel() signal cancel()
default property alias boxData: box.body
property alias box: box
property alias summary: summary property alias summary: summary
property alias details: details property alias details: details
property bool okClicked: false property bool okClicked: false
@ -19,31 +22,38 @@ HPopup {
property bool okEnabled: true property bool okEnabled: true
box.clickButtonOnEnter: "ok" contentItem: HBox {
box.buttonModel: [ id: box
{ name: "ok", text: okText, iconName: "ok", enabled: okEnabled}, clickButtonOnEnter: "ok"
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
] buttonModel: [
box.buttonCallbacks: ({ { name: "ok", text: okText, iconName: "ok", enabled: okEnabled},
ok: button => { okClicked = true; popup.ok(); popup.close() }, { name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
cancel: button => { okClicked = false; popup.cancel(); popup.close() }, ]
})
buttonCallbacks: ({
ok: button => { okClicked = true; popup.ok(); popup.close() },
cancel: button => {
okClicked = false; popup.cancel(); popup.close()
},
})
HLabel { HLabel {
id: summary id: summary
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.bold: true font.bold: true
visible: Boolean(text) visible: Boolean(text)
Layout.fillWidth: true Layout.fillWidth: true
} }
HLabel { HLabel {
id: details id: details
wrapMode: Text.Wrap wrapMode: Text.Wrap
visible: Boolean(text) visible: Boolean(text)
Layout.fillWidth: true Layout.fillWidth: true
}
} }
} }