diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-01-11 09:33:48 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-12 08:31:35 -0800 |
commit | 2784f390a142676bcd9409af786d47e4aa4e6634 (patch) | |
tree | ff1aab69ee74cfe3167900fc71ce196f1d829b7f /mobile-widgets/qml | |
parent | 0cb533abcb5c4a2005d0c1183d62aa88917e70a9 (diff) | |
download | subsurface-2784f390a142676bcd9409af786d47e4aa4e6634.tar.gz |
mobile/UI: better sizing for Global Drawer header image
Especially on smaller screens in landscape mode (which is nice for
statistics) the image took up way too much space. Now it gets cropped in
a way that makes sure all the information text is visible, but not too
much space is stolen from the rest of the menu.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/main.qml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 298b746c9..1e5e1bdba 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -194,16 +194,19 @@ Kirigami.ApplicationWindow { Backend.cloud_verification_status === Enums.CS_VERIFIED) topContent: Image { source: "qrc:/qml/icons/dive.jpg" + // it's a 4x3 image, but clip if it takes too much space (making sure the text fits) + property int myHeight: Math.min(Math.max(rootItem.height * 0.3, textblock.height + Kirigami.Units.largeSpacing), parent.width * 0.75) Layout.fillWidth: true + Layout.maximumHeight: myHeight sourceSize.width: parent.width - fillMode: Image.PreserveAspectFit + fillMode: Image.PreserveAspectCrop LinearGradient { anchors { left: parent.left right: parent.right top: parent.top } - height: textblock.height * 2 + height: Math.min(textblock.height * 2, parent.myHeight) start: Qt.point(0, 0) end: Qt.point(0, height) gradient: Gradient { |