• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. Kirigami
  • KDE Home
  • Contact Us

Quick Links

Skip menu "Kirigami"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Related Pages

Class Picker

About

QtQuick plugins to build user interfaces based on the KDE UX guidelines

Maintainer
Marco Martin
Supported platforms
Android, Linux
Community
IRC: #plasma on Freenode
Mailing list: plasma-devel
Use with CMake
find_package(KF5Kirigami)
target_link_libraries(yourapp KF5::Kirigami)
Clone
git clone git://anongit.kde.org/kirigami1.git
Browse source
Kirigami on cgit.kde.org

Kirigami

  • src
  • controls
controls/ApplicationWindow.qml
1 /*
2  * Copyright 2015 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2 or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 import QtQuick 2.5
21 import QtQuick.Controls.Private 1.0
22 import "templates/private"
23 import org.kde.kirigami 1.0 as Kirigami
24 import QtGraphicalEffects 1.0
25 
98 AbstractApplicationWindow {
99  id: root
100 
111  property alias pageStack: __pageStack
112 
113  //redefines here as here we can know a pointer to PageRow
114  wideScreen: width >= applicationWindow().pageStack.defaultColumnWidth*2
115 
116  PageRow {
117  id: __pageStack
118  anchors {
119  fill: parent
120  //HACK: workaround a bug in android iOS keyboard management
121  bottomMargin: ((Qt.platform.os == "android" || Qt.platform.os == "ios") || !Qt.inputMethod.visible) ? 0 : Qt.inputMethod.keyboardRectangle.height
122  onBottomMarginChanged: {
123  if (bottomMargin > 0) {
124  root.reachableMode = false;
125  }
126  }
127  }
128  //FIXME
129  onCurrentIndexChanged: root.reachableMode = false;
130 
131  function goBack() {
132  if (root.contextDrawer && root.contextDrawer.opened && root.contextDrawer.modal) {
133  root.contextDrawer.close();
134  } else if (root.globalDrawer && root.globalDrawer.opened && root.globalDrawer.modal) {
135  root.globalDrawer.close();
136  } else {
137  var backEvent = {accepted: false}
138  if (root.pageStack.currentIndex >= 1) {
139  root.pageStack.currentItem.backRequested(backEvent);
140  if (!backEvent.accepted) {
141  if (root.pageStack.depth > 1) {
142  root.pageStack.currentIndex = Math.max(0, root.pageStack.currentIndex - 1);
143  backEvent.accepted = true;
144  }
145  }
146  }
147 
148  if (Settings.isMobile && !backEvent.accepted && Qt.platform.os !== "ios") {
149  Qt.quit();
150  }
151  }
152  }
153  Keys.onReleased: {
154  if (event.key == Qt.Key_Back ||
155  (event.key === Qt.Key_Left && (event.modifiers & Qt.AltModifier))) {
156  event.accepted = true;
157  goBack();
158  }
159  }
160 
161  Rectangle {
162  z: -1
163  anchors.fill: parent
164  color: Kirigami.Theme.backgroundColor
165  }
166  focus: true
167  }
168 
169  Component.onCompleted: {
170  if (root.header === undefined) {
171  var component = Qt.createComponent(Qt.resolvedUrl("./ApplicationHeader.qml"));
172  root.header = component.createObject(root.contentItem.parent);
173  }
174  }
175 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Fri Feb 17 2017 11:09:23 by doxygen 1.8.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal