Skip to content

Commit 615efd4

Browse files
committed
qml: adjust dialog size to message length
fixes #7
1 parent b22dfc2 commit 615efd4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

qml/main.qml

+13-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ ApplicationWindow {
77

88
property var windowWidth: Math.round(fontMetrics.height * 32.2856)
99
property var windowHeight: Math.round(fontMetrics.height * 13.9528)
10+
property var heightSafeMargin: 15
1011

11-
maximumWidth: windowWidth
12-
maximumHeight: windowHeight
13-
minimumWidth: windowWidth
14-
minimumHeight: windowHeight
12+
minimumWidth: Math.max(windowWidth, mainLayout.Layout.minimumWidth) + mainLayout.anchors.margins * 2
13+
minimumHeight: Math.max(windowHeight, mainLayout.Layout.minimumHeight) + mainLayout.anchors.margins * 2 + heightSafeMargin
14+
maximumWidth: minimumWidth
15+
maximumHeight: minimumHeight
1516
visible: true
1617
onClosing: {
1718
hpa.setResult("fail");
@@ -28,6 +29,8 @@ ApplicationWindow {
2829
}
2930

3031
Item {
32+
id: mainLayout
33+
3134
anchors.fill: parent
3235
Keys.onEscapePressed: (e) => {
3336
hpa.setResult("fail");
@@ -46,6 +49,9 @@ ApplicationWindow {
4649
font.pointSize: Math.round(fontMetrics.height * 1.05)
4750
text: "Authenticating for " + hpa.getUser()
4851
Layout.alignment: Qt.AlignHCenter
52+
Layout.maximumWidth: parent.width
53+
elide: Text.ElideRight
54+
wrapMode: Text.WordWrap
4955
}
5056

5157
HSeparator {
@@ -56,6 +62,9 @@ ApplicationWindow {
5662
Label {
5763
color: system.windowText
5864
text: hpa.getMessage()
65+
Layout.maximumWidth: parent.width
66+
elide: Text.ElideRight
67+
wrapMode: Text.WordWrap
5968
}
6069

6170
TextField {

0 commit comments

Comments
 (0)