Warning, /frameworks/kirigami/src/controls/ApplicationWindow.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import org.kde.kirigami as Kirigami 0009 0010 /** 0011 * @brief A window that provides some basic features needed for all apps 0012 * 0013 * It's usually used as a root QML component for the application. 0014 * It's based around the PageRow component, the application will be 0015 * about pages adding and removal. 0016 * For most of the usages, this class should be used instead 0017 * of AbstractApplicationWindow 0018 * @see AbstractApplicationWindow 0019 * 0020 * Setting a width and height property on the ApplicationWindow 0021 * will set its initial size, but it won't set it as an automatically binding. 0022 * to resize programmatically the ApplicationWindow they need to 0023 * be assigned again in an imperative fashion 0024 * 0025 * Example usage: 0026 * @code 0027 * import org.kde.kirigami 2.4 as Kirigami 0028 * 0029 * Kirigami.ApplicationWindow { 0030 * [...] 0031 * globalDrawer: Kirigami.GlobalDrawer { 0032 * actions: [ 0033 * Kirigami.Action { 0034 * text: "View" 0035 * icon.name: "view-list-icons" 0036 * Kirigami.Action { 0037 * text: "action 1" 0038 * } 0039 * Kirigami.Action { 0040 * text: "action 2" 0041 * } 0042 * Kirigami.Action { 0043 * text: "action 3" 0044 * } 0045 * }, 0046 * Kirigami.Action { 0047 * text: "Sync" 0048 * icon.name: "folder-sync" 0049 * } 0050 * ] 0051 * } 0052 * 0053 * contextDrawer: Kirigami.ContextDrawer { 0054 * id: contextDrawer 0055 * } 0056 * 0057 * pageStack.initialPage: Kirigami.Page { 0058 * mainAction: Kirigami.Action { 0059 * icon.name: "edit" 0060 * onTriggered: { 0061 * // do stuff 0062 * } 0063 * } 0064 * contextualActions: [ 0065 * Kirigami.Action { 0066 * icon.name: "edit" 0067 * text: "Action text" 0068 * onTriggered: { 0069 * // do stuff 0070 * } 0071 * }, 0072 * Kirigami.Action { 0073 * icon.name: "edit" 0074 * text: "Action text" 0075 * onTriggered: { 0076 * // do stuff 0077 * } 0078 * } 0079 * ] 0080 * [...] 0081 * } 0082 * [...] 0083 * } 0084 * @endcode 0085 * 0086 */ 0087 Kirigami.AbstractApplicationWindow { 0088 id: root 0089 0090 /** 0091 * @brief This property holds the stack used to allocate the pages and to 0092 * manage the transitions between them. 0093 * 0094 * It's using a PageRow, while having the same API as PageStack, 0095 * it positions the pages as adjacent columns, with as many columns 0096 * as can fit in the screen. An handheld device would usually have a single 0097 * fullscreen column, a tablet device would have many tiled columns. 0098 * 0099 * @property org::kde::kirigami::PageRow pageStack 0100 */ 0101 readonly property alias pageStack: __pageStack 0102 0103 // Redefined here as here we can know a pointer to PageRow. 0104 // We negate the canBeEnabled check because we don't want to factor in the automatic drawer provided by Kirigami for page actions for our calculations 0105 wideScreen: width >= (root.pageStack.defaultColumnWidth) + ((contextDrawer && !(contextDrawer instanceof Kirigami.ContextDrawer)) ? contextDrawer.width : 0) + (globalDrawer ? globalDrawer.width : 0) 0106 0107 Component.onCompleted: { 0108 pageStack.currentItem?.forceActiveFocus() 0109 } 0110 0111 Kirigami.PageRow { 0112 id: __pageStack 0113 globalToolBar.style: Kirigami.ApplicationHeaderStyle.Auto 0114 anchors { 0115 fill: parent 0116 // HACK: workaround a bug in android iOS keyboard management 0117 bottomMargin: ((Qt.platform.os === "android" || Qt.platform.os === "ios") || !Qt.inputMethod.visible) ? 0 : Qt.inputMethod.keyboardRectangle.height 0118 } 0119 0120 focus: true 0121 } 0122 }