From 615efd49303cb164bbf4ad065792e02d8f652a36 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 1 Nov 2024 22:25:26 +0000 Subject: [PATCH] qml: adjust dialog size to message length fixes #7 --- qml/main.qml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index 993b939..2b9ec15 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -7,11 +7,12 @@ ApplicationWindow { property var windowWidth: Math.round(fontMetrics.height * 32.2856) property var windowHeight: Math.round(fontMetrics.height * 13.9528) + property var heightSafeMargin: 15 - maximumWidth: windowWidth - maximumHeight: windowHeight - minimumWidth: windowWidth - minimumHeight: windowHeight + minimumWidth: Math.max(windowWidth, mainLayout.Layout.minimumWidth) + mainLayout.anchors.margins * 2 + minimumHeight: Math.max(windowHeight, mainLayout.Layout.minimumHeight) + mainLayout.anchors.margins * 2 + heightSafeMargin + maximumWidth: minimumWidth + maximumHeight: minimumHeight visible: true onClosing: { hpa.setResult("fail"); @@ -28,6 +29,8 @@ ApplicationWindow { } Item { + id: mainLayout + anchors.fill: parent Keys.onEscapePressed: (e) => { hpa.setResult("fail"); @@ -46,6 +49,9 @@ ApplicationWindow { font.pointSize: Math.round(fontMetrics.height * 1.05) text: "Authenticating for " + hpa.getUser() Layout.alignment: Qt.AlignHCenter + Layout.maximumWidth: parent.width + elide: Text.ElideRight + wrapMode: Text.WordWrap } HSeparator { @@ -56,6 +62,9 @@ ApplicationWindow { Label { color: system.windowText text: hpa.getMessage() + Layout.maximumWidth: parent.width + elide: Text.ElideRight + wrapMode: Text.WordWrap } TextField {