From 9afd419533266c6c94d03673a5dc1faae4eec9f0 Mon Sep 17 00:00:00 2001 From: Aditya Mehra Date: Thu, 12 Jan 2023 23:57:04 +1030 Subject: [PATCH] fix scaling of buttons on backend select --- ui/BackendButton.qml | 11 ++++------- ui/BackendSelect.qml | 13 +++++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ui/BackendButton.qml b/ui/BackendButton.qml index 7b71e49..c36a6c7 100644 --- a/ui/BackendButton.qml +++ b/ui/BackendButton.qml @@ -29,6 +29,7 @@ Button { property string backendIcon property string backendType property bool horizontalMode: false + property var fontSize background: Rectangle { color: backendButtonControl.down ? "transparent" : Kirigami.Theme.highlightColor @@ -101,9 +102,7 @@ Button { horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap elide: Text.ElideRight - font.pixelSize: 32 - minimumPixelSize: 8 - fontSizeMode: Text.Fit + font.pixelSize: backendButtonControl.fontSize text: backendButtonContentsLayout.backendName } @@ -140,11 +139,9 @@ Button { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - font.pixelSize: 32 - minimumPixelSize: 16 - fontSizeMode: Text.Fit + font.pixelSize: backendButtonControl.fontSize text: backendButtonContentsLayout.backendName } } } -} \ No newline at end of file +} diff --git a/ui/BackendSelect.qml b/ui/BackendSelect.qml index 89d6892..506a1ad 100644 --- a/ui/BackendSelect.qml +++ b/ui/BackendSelect.qml @@ -25,7 +25,9 @@ import Mycroft 1.0 as Mycroft Item { id: backendView - anchors.fill: parent + //anchors.fill: parent + width: 700 + height: 400 property bool horizontalMode: backendView.width > backendView.height ? 1 : 0 Rectangle { @@ -37,7 +39,7 @@ Item { anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - height: Kirigami.Units.gridUnit * 4 + height: Kirigami.Units.gridUnit * 3 color: Kirigami.Theme.highlightColor Kirigami.Icon { @@ -89,7 +91,7 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.top: topArea.bottom - anchors.margins: Mycroft.Units.gridUnit * 2 + anchors.margins: Mycroft.Units.gridUnit * 1 Label { id: warnText @@ -104,7 +106,7 @@ Item { Item { Layout.fillWidth: true Layout.fillHeight: true - Layout.margins: horizontalMode ? Kirigami.Units.largeSpacing : 0 + Layout.margins: horizontalMode ? Kirigami.Units.smallSpacing : 0 GridLayout { id: backendsGrid @@ -120,6 +122,7 @@ Item { backendIcon: Qt.resolvedUrl("icons/selene.svg") backendType: "selene" horizontalMode: backendView.horizontalMode + fontSize: warnText.font.pixelSize * 0.9 Layout.preferredWidth: horizontalMode ? (parent.width / 3 - Kirigami.Units.gridUnit) : parent.width Layout.fillHeight: true @@ -131,6 +134,7 @@ Item { backendIcon: Qt.resolvedUrl("icons/personal.svg") backendType: "personal" horizontalMode: backendView.horizontalMode + fontSize: warnText.font.pixelSize * 0.9 Layout.preferredWidth: horizontalMode ? (parent.width / 3 - Kirigami.Units.gridUnit) : parent.width Layout.fillHeight: true @@ -142,6 +146,7 @@ Item { backendIcon: Qt.resolvedUrl("icons/nobackend.svg") backendType: "offline" horizontalMode: backendView.horizontalMode + fontSize: warnText.font.pixelSize * 0.9 Layout.preferredWidth: horizontalMode ? (parent.width / 3 - Kirigami.Units.gridUnit) : parent.width Layout.fillHeight: true