From 85bdbcf5bea24ba03c13a06bbdb0571215a9b72e Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 9 Sep 2019 12:50:00 -0400 Subject: [PATCH] Move HBox stuff from HPopup to BoxPopup --- src/qml/Base/HBox.qml | 2 +- src/qml/Base/HPopup.qml | 9 ------- src/qml/Popups/BoxPopup.qml | 52 ++++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/qml/Base/HBox.qml b/src/qml/Base/HBox.qml index df4826e8..d07fd310 100644 --- a/src/qml/Base/HBox.qml +++ b/src/qml/Base/HBox.qml @@ -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 diff --git a/src/qml/Base/HPopup.qml b/src/qml/Base/HPopup.qml index 699b3c8b..7e2ab299 100644 --- a/src/qml/Base/HPopup.qml +++ b/src/qml/Base/HPopup.qml @@ -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 - } } diff --git a/src/qml/Popups/BoxPopup.qml b/src/qml/Popups/BoxPopup.qml index 208c3143..0f62d4db 100644 --- a/src/qml/Popups/BoxPopup.qml +++ b/src/qml/Popups/BoxPopup.qml @@ -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,31 +22,38 @@ HPopup { property bool okEnabled: true - box.clickButtonOnEnter: "ok" - box.buttonModel: [ - { name: "ok", text: okText, iconName: "ok", enabled: okEnabled}, - { name: "cancel", text: qsTr("Cancel"), iconName: "cancel" }, - ] - box.buttonCallbacks: ({ - ok: button => { okClicked = true; popup.ok(); popup.close() }, - cancel: button => { okClicked = false; popup.cancel(); popup.close() }, - }) + contentItem: HBox { + id: box + clickButtonOnEnter: "ok" + + buttonModel: [ + { name: "ok", text: okText, iconName: "ok", enabled: okEnabled}, + { name: "cancel", text: qsTr("Cancel"), iconName: "cancel" }, + ] + + buttonCallbacks: ({ + ok: button => { okClicked = true; popup.ok(); popup.close() }, + cancel: button => { + okClicked = false; popup.cancel(); popup.close() + }, + }) - HLabel { - id: summary - wrapMode: Text.Wrap - font.bold: true - visible: Boolean(text) + HLabel { + id: summary + wrapMode: Text.Wrap + font.bold: true + visible: Boolean(text) - Layout.fillWidth: true - } + Layout.fillWidth: true + } - HLabel { - id: details - wrapMode: Text.Wrap - visible: Boolean(text) + HLabel { + id: details + wrapMode: Text.Wrap + visible: Boolean(text) - Layout.fillWidth: true + Layout.fillWidth: true + } } }