Skip to content

Commit 593b7e7

Browse files
committed
Merge #484: Fix layout issues in ExternalPopup.qml
8c7f2cb Fix layout issues in ExternalPopup.qml (johnny9) Pull request description: Simplifies the layout in ExternalPopup by using CoreText instead of Navigation bar for the title, removing an extra ColumnLayout, and using GridLayout to handle the difference between mobile and desktop. This resolves the "Qt Quick Layouts: Polish loop detected" warning. Fixes #483 ACKs for top commit: hebasto: ACK 8c7f2cb, tested on Ubuntu 24.04. Tree-SHA512: 556b3c334b330a5db10f44e34e857a1d2a07784ca1eaae6af6e6b456b752bf7a9f40f8b5d34a2ef8d6aae69c1e67ca94f9b588e68fcfb04ceae39e34f43d4306
2 parents 1be0d18 + 8c7f2cb commit 593b7e7

File tree

1 file changed

+25
-60
lines changed

1 file changed

+25
-60
lines changed

qml/components/ExternalPopup.qml

Lines changed: 25 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Popup {
1414
property string link: ""
1515
modal: true
1616
padding: 0
17+
anchors.centerIn: parent
1718

1819
background: Rectangle {
1920
color: Theme.color.background
@@ -24,86 +25,50 @@ Popup {
2425
anchors.fill: parent
2526
spacing: 0
2627

27-
NavigationBar {
28+
CoreText {
29+
Layout.fillWidth: true
2830
Layout.preferredHeight: 55
29-
middleDetail: Header {
30-
Layout.fillWidth: true
31-
header: qsTr("External Link")
32-
headerBold: true
33-
headerSize: 24
34-
}
31+
text: qsTr("External Link")
32+
bold: true
33+
font.pixelSize: 24
34+
horizontalAlignment: Text.AlignHCenter
35+
verticalAlignment: Text.AlignVCenter
3536
}
3637

3738
Separator {
3839
Layout.fillWidth: true
3940
}
4041

41-
ColumnLayout {
42-
id: popupContent
42+
Header {
4343
Layout.fillWidth: true
44-
Layout.rightMargin: 20
45-
Layout.leftMargin: 20
44+
Layout.margins: 20
4645
Layout.topMargin: 20
47-
Layout.bottomMargin: 20
48-
spacing: 30
49-
Header {
50-
Layout.fillWidth: true
51-
header: qsTr("Do you want to open the following website in your browser?")
52-
headerBold: false
53-
headerSize: 18
54-
description: ("\"" + externalConfirmPopup.link + "\"")
55-
descriptionMargin: 3
56-
}
57-
Loader {
58-
id: layoutLoader
59-
Layout.fillWidth: true
60-
sourceComponent: AppMode.isDesktop ? desktopLayout : mobileLayout
61-
}
46+
header: qsTr("Do you want to open the following website in your browser?")
47+
headerBold: false
48+
headerSize: 16
49+
description: ("\"" + externalConfirmPopup.link + "\"")
50+
descriptionMargin: 8
6251
}
63-
}
6452

65-
Component {
66-
id: desktopLayout
67-
RowLayout {
53+
GridLayout {
6854
Layout.fillWidth: true
69-
spacing: 15
70-
OutlineButton {
71-
text: qsTr("Cancel")
72-
Layout.fillWidth: true
73-
Layout.minimumWidth: 150
74-
onClicked: {
75-
externalConfirmPopup.close()
76-
}
77-
}
78-
ContinueButton {
79-
text: qsTr("Ok")
80-
Layout.fillWidth: true
81-
Layout.minimumWidth: 150
82-
onClicked: {
83-
Qt.openUrlExternally(externalConfirmPopup.link)
84-
externalConfirmPopup.close()
85-
}
86-
}
87-
}
88-
}
55+
Layout.margins: 20
56+
Layout.topMargin: 0
57+
columns: AppMode.isDesktop ? 2 : 1
58+
columnSpacing: 15
59+
rowSpacing: 10
8960

90-
Component {
91-
id: mobileLayout
92-
ColumnLayout {
93-
Layout.fillWidth: true
94-
spacing: 15
9561
OutlineButton {
9662
text: qsTr("Cancel")
9763
Layout.fillWidth: true
98-
Layout.minimumWidth: 150
99-
onClicked: {
100-
externalConfirmPopup.close()
101-
}
64+
Layout.minimumWidth: 120
65+
onClicked: externalConfirmPopup.close()
10266
}
67+
10368
ContinueButton {
10469
text: qsTr("Ok")
10570
Layout.fillWidth: true
106-
Layout.minimumWidth: 150
71+
Layout.minimumWidth: 120
10772
onClicked: {
10873
Qt.openUrlExternally(externalConfirmPopup.link)
10974
externalConfirmPopup.close()

0 commit comments

Comments
 (0)