| 1 | import QtQuick 2.1 |
|---|
| 2 | import QtQuick.Controls 2.0 as QQC2 |
|---|
| 3 | import org.kde.kirigami 2.4 as Kirigami |
|---|
| 4 | Kirigami.ApplicationWindow { |
|---|
| 5 | id: root |
|---|
| 6 | header: Kirigami.ApplicationHeader {} |
|---|
| 7 | globalDrawer: Kirigami.GlobalDrawer { |
|---|
| 8 | title: "Hello App" |
|---|
| 9 | titleIcon: "applications-graphics" |
|---|
| 10 | actions: [ |
|---|
| 11 | Kirigami.Action { |
|---|
| 12 | text: "View" |
|---|
| 13 | iconName: "view-list-icons" |
|---|
| 14 | Kirigami.Action { |
|---|
| 15 | text: "action 1" |
|---|
| 16 | } |
|---|
| 17 | Kirigami.Action { |
|---|
| 18 | text: "action 2" |
|---|
| 19 | } |
|---|
| 20 | Kirigami.Action { |
|---|
| 21 | text: "action 3" |
|---|
| 22 | } |
|---|
| 23 | }, |
|---|
| 24 | Kirigami.Action { |
|---|
| 25 | text: "action 3" |
|---|
| 26 | }, |
|---|
| 27 | Kirigami.Action { |
|---|
| 28 | text: "action 4" |
|---|
| 29 | } |
|---|
| 30 | ] |
|---|
| 31 | } |
|---|
| 32 | contextDrawer: Kirigami.ContextDrawer { |
|---|
| 33 | id: contextDrawer |
|---|
| 34 | } |
|---|
| 35 | pageStack.initialPage: mainPageComponent |
|---|
| 36 | Component { |
|---|
| 37 | id: mainPageComponent |
|---|
| 38 | Kirigami.ScrollablePage { |
|---|
| 39 | title: "Hello" |
|---|
| 40 | actions { |
|---|
| 41 | main: Kirigami.Action { |
|---|
| 42 | iconName: sheet.sheetOpen ? "dialog-cancel" : "document-edit" |
|---|
| 43 | onTriggered: { |
|---|
| 44 | print("Action button in buttons page clicked"); |
|---|
| 45 | sheet.sheetOpen = !sheet.sheetOpen |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | left: Kirigami.Action { |
|---|
| 49 | iconName: "go-previous" |
|---|
| 50 | onTriggered: { |
|---|
| 51 | print("Left action triggered") |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | right: Kirigami.Action { |
|---|
| 55 | iconName: "go-next" |
|---|
| 56 | onTriggered: { |
|---|
| 57 | print("Right action triggered") |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | contextualActions: [ |
|---|
| 61 | Kirigami.Action { |
|---|
| 62 | text:"Action for buttons" |
|---|
| 63 | iconName: "bookmarks" |
|---|
| 64 | onTriggered: print("Action 1 clicked") |
|---|
| 65 | }, |
|---|
| 66 | Kirigami.Action { |
|---|
| 67 | text:"Action 2" |
|---|
| 68 | iconName: "folder" |
|---|
| 69 | enabled: false |
|---|
| 70 | }, |
|---|
| 71 | Kirigami.Action { |
|---|
| 72 | text: "Action for Sheet" |
|---|
| 73 | visible: sheet.sheetOpen |
|---|
| 74 | } |
|---|
| 75 | ] |
|---|
| 76 | } |
|---|
| 77 | Kirigami.OverlaySheet { |
|---|
| 78 | id: sheet |
|---|
| 79 | onSheetOpenChanged: page.actions.main.checked = sheetOpen |
|---|
| 80 | QQC2.Label { |
|---|
| 81 | wrapMode: Text.WordWrap |
|---|
| 82 | text: "Lorem ipsum dolor sit amet" |
|---|
| 83 | } |
|---|
| 84 | } |
|---|
| 85 | //Page contents... |
|---|
| 86 | } |
|---|
| 87 | } |
|---|
| 88 | } |
|---|