Преглед на файлове

Better error dialog sizing and text wrapping

Malte Veerman преди 6 години
родител
ревизия
30717b312c
променени са 2 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 2 2
      fancontrol-gui/package/contents/ui/Application.qml
  2. 4 1
      import/qml/ErrorDialog.qml

+ 2 - 2
fancontrol-gui/package/contents/ui/Application.qml

@@ -169,8 +169,8 @@ Kirigami.ApplicationWindow {
         id: errorDialog
 
         visible: false
-        x: (window.width - width) / 2
-        y: (window.height - height) / 2
+        x: (parent.width - width) / 2
+        y: (parent.height - height) / 2
     }
 
 //     Dialog {

+ 4 - 1
import/qml/ErrorDialog.qml

@@ -28,14 +28,17 @@ Dialog {
     id: dialog
 
     title: i18n("Error")
-    width: text.implicitWidth + Kirigami.Units.smallSpacing * 2
+    width: Math.min(text.implicitWidth + Kirigami.Units.smallSpacing * 2, parent.width - Kirigami.Units.largeSpacing * 2)
     standardButtons: Dialog.Close
     onRejected: close()
 
     Label {
         id: text
+
         anchors.centerIn: parent
         text: ""
+        wrapMode: Text.Wrap
+        width: parent.width - Kirigami.Units.smallSpacing * 2
     }
 
     Connections {