Use the font size that Qt suggest
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Thu, 14 Oct 2021 11:07:27 +0000 (13:07 +0200)
committerallexzander (Rebase PR Action) <allexzander@users.noreply.github.com>
Mon, 17 Jan 2022 11:11:57 +0000 (11:11 +0000)
Fixes: https://github.com/nextcloud/desktop/issues/3797
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
src/gui/tray/ActivityItem.qml
src/gui/tray/UserLine.qml
theme/Style/Style.qml

index 9fa4f8ccc9a27b2f64642711402260e7c2b7aba2..598ae3b76b50ee9f842cdc0d969351c87c185bec 100644 (file)
@@ -216,7 +216,7 @@ MouseArea {
                     anchors.right: moreActionsButton.right
                     anchors.top: moreActionsButton.top
                     
-                    Menu {
+                    AutoSizingMenu {
                         id: moreActionsButtonContextMenu
                         anchors.centerIn: parent
                         
index ecdc6792a3c038d9815af3c451f1e8f8d9be9f63..442dc1f58fe02dd7fa87ea03774b14b4eb6dd889 100644 (file)
@@ -111,14 +111,12 @@ MenuItem {
                         width: parent.width\r
                         Label {\r
                             id: emoji\r
-                            height: Style.topLinePixelSize\r
                             visible: model.statusEmoji !== ""\r
                             text: statusEmoji\r
                             topPadding: -Style.accountLabelsSpacing\r
                         }\r
                         Label {\r
                             id: message\r
-                            height: Style.topLinePixelSize\r
                             width: parent.width - parent.spacing - emoji.width\r
                             visible: model.statusMessage !== ""\r
                             text: statusMessage\r
@@ -169,9 +167,8 @@ MenuItem {
                 y: userMoreButton.y + 1\r
             }\r
 \r
-            Menu {\r
+            AutoSizingMenu {\r
                 id: userMoreButtonMenu\r
-                width: 120\r
                 closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape\r
 \r
                 background: Rectangle {\r
index b29db7aafbf7864bba282ddc9f39dddf127a26a0..24dc138eea0cdc7b0b939867afbeacc386f92c82 100644 (file)
@@ -1,11 +1,12 @@
 pragma Singleton\r
 \r
-// Minimum for this is Qt 5.5\r
-import QtQuick 2.5\r
+import QtQuick 2.15\r
 \r
 import com.nextcloud.desktopclient 1.0\r
 \r
-QtObject {\r
+Item {\r
+    readonly property int pixelSize: fontMetrics.font.pixelSize\r
+\r
     // Colors\r
     property color ncBlue:      Theme.wizardHeaderBackgroundColor\r
     property color ncTextColor: Theme.wizardHeaderTitleColor\r
@@ -19,15 +20,15 @@ QtObject {
 \r
     // Fonts\r
     // We are using pixel size because this is cross platform comparable, point size isn't\r
-    property int topLinePixelSize: 12\r
-    property int subLinePixelSize: 10\r
+    readonly property int topLinePixelSize: pixelSize\r
+    readonly property int subLinePixelSize: topLinePixelSize - 2\r
 \r
     // Dimensions and sizes\r
-    property int trayWindowWidth: 400\r
-    property int trayWindowHeight: 510\r
+    property int trayWindowWidth: variableSize(400)\r
+    property int trayWindowHeight: variableSize(510)\r
     property int trayWindowRadius: 10\r
     property int trayWindowBorderWidth: 1\r
-    property int trayWindowHeaderHeight: 60\r
+    property int trayWindowHeaderHeight: variableSize(60)\r
 \r
     property int currentAccountButtonWidth: 220\r
     property int currentAccountButtonRadius: 2\r
@@ -72,4 +73,12 @@ QtObject {
     readonly property int unifiedSearchResulSublineFontSize: subLinePixelSize\r
     readonly property string unifiedSearchResulTitleColor: "black"\r
     readonly property string unifiedSearchResulSublineColor: "grey"\r
+\r
+    function variableSize(size) {\r
+        return size * (1 + Math.min(pixelSize / 100, 1));       \r
+    }\r
+\r
+    FontMetrics {\r
+        id: fontMetrics\r
+    }\r
 }\r