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 2.5 0008 import org.kde.kirigami 2.4 as Kirigami 0009 0010 /** 0011 * @brief A window that provides some basic features needed for all apps. 0012 * 0013 * An application window is a top-level component that provides 0014 * several utilities for convenience, such as: 0015 * * kirigami::AbstractApplicationWindow::applicationWindow() 0016 * * kirigami::AbstractApplicationWindow::globalDrawer 0017 * * kirigami::AbstractApplicationWindow::pageStack 0018 * * kirigami::AbstractApplicationWindow::wideScreen 0019 * 0020 * @see kirigami::AbstractApplicationWindow 0021 * 0022 * Use this class only if you need custom content for your application that is 0023 * different from the PageRow behavior recommended by the HIG and provided 0024 * by kirigami::AbstractApplicationWindow. 0025 * 0026 * Example usage: 0027 * @code{.qml} 0028 * import org.kde.kirigami 2.4 as Kirigami 0029 * 0030 * Kirigami.ApplicationWindow { 0031 * [...] 0032 * globalDrawer: Kirigami.GlobalDrawer { 0033 * actions: [ 0034 * Kirigami.Action { 0035 * text: "View" 0036 * iconName: "view-list-icons" 0037 * Kirigami.Action { 0038 * text: "action 1" 0039 * } 0040 * Kirigami.Action { 0041 * text: "action 2" 0042 * } 0043 * Kirigami.Action { 0044 * text: "action 3" 0045 * } 0046 * }, 0047 * Kirigami.Action { 0048 * text: "Sync" 0049 * iconName: "folder-sync" 0050 * } 0051 * ] 0052 * } 0053 * 0054 * contextDrawer: Kirigami.ContextDrawer { 0055 * id: contextDrawer 0056 * } 0057 * 0058 * pageStack.initialPage: Kirigami.Page { 0059 * actions { 0060 * main: Kirigami.Action { 0061 * iconName: "edit" 0062 * onTriggered: { 0063 * // do stuff 0064 * } 0065 * } 0066 * contextualActions: [ 0067 * Kirigami.Action { 0068 * iconName: "edit" 0069 * text: "Action text" 0070 * onTriggered: { 0071 * // do stuff 0072 * } 0073 * }, 0074 * Kirigami.Action { 0075 * iconName: "edit" 0076 * text: "Action text" 0077 * onTriggered: { 0078 * // do stuff 0079 * } 0080 * } 0081 * ] 0082 * } 0083 * } 0084 * [...] 0085 * } 0086 * @endcode 0087 */ 0088 Kirigami.AbstractApplicationWindow { 0089 id: root 0090 0091 /** 0092 * @brief This property holds the PageRow that is used to allocate the pages 0093 * and manage the transitions between them. 0094 * 0095 * It implements useful features to control then shown pages such as: 0096 * * kirigami::PageRow::initialPage 0097 * * kirigami::PageRow::push() 0098 * * kirigami::PageRow::pop() 0099 * 0100 * @see kirigami::PageRow 0101 * @warning This property is not currently readonly, but it should be treated like it is readonly. 0102 * @property Kirgiami.PageRow pageStack 0103 */ 0104 property alias pageStack: __pageStack // TODO KF6 make readonly 0105 0106 // Redefined here as here we can know a pointer to PageRow. 0107 // 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 0108 wideScreen: width >= (root.pageStack.defaultColumnWidth) + ((contextDrawer && !(contextDrawer instanceof Kirigami.ContextDrawer)) ? contextDrawer.width : 0) + (globalDrawer ? globalDrawer.width : 0) 0109 0110 Component.onCompleted: { 0111 if (pageStack.currentItem) { 0112 pageStack.currentItem.forceActiveFocus() 0113 } 0114 } 0115 0116 PageRow { 0117 id: __pageStack 0118 globalToolBar.style: Kirigami.ApplicationHeaderStyle.Auto 0119 anchors { 0120 fill: parent 0121 // HACK: workaround a bug in android iOS keyboard management 0122 bottomMargin: ((Qt.platform.os === "android" || Qt.platform.os === "ios") || !Qt.inputMethod.visible) ? 0 : Qt.inputMethod.keyboardRectangle.height 0123 onBottomMarginChanged: { 0124 if (__pageStack.anchors.bottomMargin > 0) { 0125 root.reachableMode = false; 0126 } 0127 } 0128 } 0129 // FIXME 0130 onCurrentIndexChanged: root.reachableMode = false; 0131 0132 focus: true 0133 } 0134 }