From 99457e8c38f56cfdf86a401545dd8c81ff15d4e4 Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Thu, 14 Oct 2021 13:07:27 +0200 Subject: [PATCH] Use the font size that Qt suggest Fixes: https://github.com/nextcloud/desktop/issues/3797 Signed-off-by: Felix Weilbach --- src/gui/tray/ActivityItem.qml | 2 +- src/gui/tray/UserLine.qml | 5 +---- theme/Style/Style.qml | 25 +++++++++++++++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index 9fa4f8ccc..598ae3b76 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -216,7 +216,7 @@ MouseArea { anchors.right: moreActionsButton.right anchors.top: moreActionsButton.top - Menu { + AutoSizingMenu { id: moreActionsButtonContextMenu anchors.centerIn: parent diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index ecdc6792a..442dc1f58 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -111,14 +111,12 @@ MenuItem { width: parent.width Label { id: emoji - height: Style.topLinePixelSize visible: model.statusEmoji !== "" text: statusEmoji topPadding: -Style.accountLabelsSpacing } Label { id: message - height: Style.topLinePixelSize width: parent.width - parent.spacing - emoji.width visible: model.statusMessage !== "" text: statusMessage @@ -169,9 +167,8 @@ MenuItem { y: userMoreButton.y + 1 } - Menu { + AutoSizingMenu { id: userMoreButtonMenu - width: 120 closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape background: Rectangle { diff --git a/theme/Style/Style.qml b/theme/Style/Style.qml index b29db7aaf..24dc138ee 100644 --- a/theme/Style/Style.qml +++ b/theme/Style/Style.qml @@ -1,11 +1,12 @@ pragma Singleton -// Minimum for this is Qt 5.5 -import QtQuick 2.5 +import QtQuick 2.15 import com.nextcloud.desktopclient 1.0 -QtObject { +Item { + readonly property int pixelSize: fontMetrics.font.pixelSize + // Colors property color ncBlue: Theme.wizardHeaderBackgroundColor property color ncTextColor: Theme.wizardHeaderTitleColor @@ -19,15 +20,15 @@ QtObject { // Fonts // We are using pixel size because this is cross platform comparable, point size isn't - property int topLinePixelSize: 12 - property int subLinePixelSize: 10 + readonly property int topLinePixelSize: pixelSize + readonly property int subLinePixelSize: topLinePixelSize - 2 // Dimensions and sizes - property int trayWindowWidth: 400 - property int trayWindowHeight: 510 + property int trayWindowWidth: variableSize(400) + property int trayWindowHeight: variableSize(510) property int trayWindowRadius: 10 property int trayWindowBorderWidth: 1 - property int trayWindowHeaderHeight: 60 + property int trayWindowHeaderHeight: variableSize(60) property int currentAccountButtonWidth: 220 property int currentAccountButtonRadius: 2 @@ -72,4 +73,12 @@ QtObject { readonly property int unifiedSearchResulSublineFontSize: subLinePixelSize readonly property string unifiedSearchResulTitleColor: "black" readonly property string unifiedSearchResulSublineColor: "grey" + + function variableSize(size) { + return size * (1 + Math.min(pixelSize / 100, 1)); + } + + FontMetrics { + id: fontMetrics + } } -- 2.30.2