diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-06-17 06:05:20 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-06-18 06:32:23 +0900 |
commit | c8ef3d792485b3b1dbb9ef699b27648e2518caa4 (patch) | |
tree | e8858baf6bae0e5f0a1d610a2109e21bb71488df /mobile-widgets/qml | |
parent | 0b16b547ae2aefb169e5221f103865e1c39a58fc (diff) | |
download | subsurface-c8ef3d792485b3b1dbb9ef699b27648e2518caa4.tar.gz |
QML UI: build our own icon and header for global drawer
Kirigami appears to have a bug that makes it fail to show our icon.
With this we can be much more flexible in what we show in the top area
of the global drawer.
Fixes #1331
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/main.qml | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 125d964ec..2d7334471 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -8,6 +8,7 @@ import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import org.subsurfacedivelog.mobile 1.0 import org.kde.kirigami 2.2 as Kirigami +import QtGraphicalEffects 1.0 Kirigami.ApplicationWindow { id: rootItem @@ -106,10 +107,63 @@ Kirigami.ApplicationWindow { } globalDrawer: Kirigami.GlobalDrawer { - title: qsTr("Subsurface") - titleIcon: "qrc:/qml/subsurface-mobile-icon.png" + topContent: Image { + source: "qrc:/qml/icons/dive.jpg" + Layout.fillWidth: true + sourceSize.width: parent.width + fillMode: Image.PreserveAspectFit + asynchronous: true + LinearGradient { + anchors { + left: parent.left + right: parent.right + top: parent.top + } + height: textblock.height * 2 + start: Qt.point(0, 0) + end: Qt.point(0, height) + gradient: Gradient { + GradientStop { + position: 0.0 + color: Qt.rgba(0, 0, 0, 0.8) + } + GradientStop { + position: 1.0 + color: "transparent" + } + } + } + ColumnLayout { + id: textblock + anchors { + left: parent.left + top: parent.top + } + RowLayout { + width: Math.min(implicitWidth, parent.width) + Layout.margins: Kirigami.Units.smallSpacing + Image { + source: "qrc:/qml/subsurface-mobile-icon.png" + fillMode: Image.PreserveAspectCrop + sourceSize.width: Kirigami.Units.iconSizes.large + width: Kirigami.Units.iconSizes.large + Layout.margins: Kirigami.Units.smallSpacing + } + Kirigami.Heading { + Layout.fillWidth: true + visible: text.length > 0 + level: 1 + color: "white" + text: "Subsurface" + wrapMode: Text.NoWrap + elide: Text.ElideRight + font.weight: Font.Normal + Layout.margins: Kirigami.Units.smallSpacing + } + } + } + } - bannerImageSource: "qrc:/qml/icons/dive.jpg" resetMenuOnTriggered: false actions: [ |