소스 검색

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 {