Commit 09746fb4 authored by Marco Martin's avatar Marco Martin
Browse files

control to show/hide the banner

parent 59ea5685
...@@ -20,17 +20,33 @@ ...@@ -20,17 +20,33 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 2.0 as Controls import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import org.kde.kirigami 2.4 as Kirigami import org.kde.kirigami 2.11 as Kirigami
import "gallery" import "gallery"
Kirigami.ApplicationWindow { Kirigami.ApplicationWindow {
id: root id: root
globalDrawer: Kirigami.GlobalDrawer { globalDrawer: Kirigami.GlobalDrawer {
id: globalDrawer
title: "Widget gallery" title: "Widget gallery"
titleIcon: "applications-graphics" titleIcon: "applications-graphics"
bannerImageSource: "banner.jpg" bannerImageSource: "banner.jpg"
showHeaderWhenCollapsed: true
header: RowLayout {
Layout.fillWidth: true
Controls.ToolButton {
icon.name: "application-menu"
visible: globalDrawer.collapsible
checked: !globalDrawer.collapsed
onClicked: globalDrawer.collapsed = !globalDrawer.collapsed
}
Kirigami.SearchField {
visible: !globalDrawer.collapsed
Layout.fillWidth: true
}
}
actions: [ actions: [
Kirigami.Action { Kirigami.Action {
text: "Top Bar Style..." text: "Top Bar Style..."
...@@ -133,10 +149,16 @@ Kirigami.ApplicationWindow { ...@@ -133,10 +149,16 @@ Kirigami.ApplicationWindow {
Kirigami.Action { Kirigami.Action {
text: "Title style..." text: "Title style..."
iconName: "format-border-set-top" iconName: "format-border-set-top"
Kirigami.Action {
text: qsTr("Show Banner")
checked: globalDrawer.bannerVisible
onTriggered: globalDrawer.bannerVisible = !globalDrawer.bannerVisible
}
Kirigami.Action { Kirigami.Action {
text: "Title And Image" text: "Title And Image"
checked: root.globalDrawer.title.length > 0 && checked: root.globalDrawer.title.length > 0 &&
root.globalDrawer.bannerImageSource.toString().length > 0 root.globalDrawer.bannerImageSource.toString().length > 0
enabled: globalDrawer.bannerVisible
onTriggered: { onTriggered: {
root.globalDrawer.title = "Widget gallery" root.globalDrawer.title = "Widget gallery"
root.globalDrawer.titleIcon = "applications-graphics" root.globalDrawer.titleIcon = "applications-graphics"
...@@ -147,6 +169,7 @@ Kirigami.ApplicationWindow { ...@@ -147,6 +169,7 @@ Kirigami.ApplicationWindow {
text: "Title Only" text: "Title Only"
checked: root.globalDrawer.title.length > 0 && checked: root.globalDrawer.title.length > 0 &&
root.globalDrawer.bannerImageSource.toString().length == 0 root.globalDrawer.bannerImageSource.toString().length == 0
enabled: globalDrawer.bannerVisible
onTriggered: { onTriggered: {
root.globalDrawer.title = "Widget gallery" root.globalDrawer.title = "Widget gallery"
root.globalDrawer.titleIcon = "applications-graphics" root.globalDrawer.titleIcon = "applications-graphics"
...@@ -157,6 +180,7 @@ Kirigami.ApplicationWindow { ...@@ -157,6 +180,7 @@ Kirigami.ApplicationWindow {
text: "None" text: "None"
checked: root.globalDrawer.title.length == 0 && checked: root.globalDrawer.title.length == 0 &&
root.globalDrawer.bannerImageSource.toString().length == 0 root.globalDrawer.bannerImageSource.toString().length == 0
enabled: globalDrawer.bannerVisible
onTriggered: { onTriggered: {
root.globalDrawer.title = "" root.globalDrawer.title = ""
root.globalDrawer.titleIcon = ""; root.globalDrawer.titleIcon = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment