9 import QtQuick.Templates 2.12 as T
10 import QtQuick.Window 2.12
11 import org.kde.kirigami 2.14 as Kirigami
12 import "templates/private" as TP
71 property Item pageStack
78 readonly
property Item activeFocusItem:
Window.activeFocusItem
85 property font font: Kirigami.Theme.defaultFont
92 property var palette: Kirigami.Theme.palette
97 property Locale locale
103 property Item menuBar
137 property bool controlsVisible:
true
157 property bool wideScreen: width >= Kirigami.Units.gridUnit * 60
224 property bool reachableMode:
false
231 property bool reachableModeEnabled:
true
238 default property alias __data: contentItemRoot.data
243 readonly
property Item contentItem: Item {
248 topMargin: controlsVisible ? (root.header ? root.header.height : 0) + (root.menuBar ? root.menuBar.height : 0) : 0
249 bottomMargin: controlsVisible && root.footer ? root.footer.height : 0
250 leftMargin: root.globalDrawer && root.globalDrawer.modal ===
false ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0
251 rightMargin: root.contextDrawer && root.contextDrawer.modal ===
false ? root.contextDrawer.contentItem.width * root.contextDrawer.position : 0
254 transform: Translate {
257 duration: Kirigami.Units.longDuration
258 easing.type: Easing.InOutQuad
261 y: root.reachableMode && root.reachableModeEnabled && !root.wideScreen ? root.height/2 : 0
262 x: root.globalDrawer && root.globalDrawer.modal ===
true && root.globalDrawer.toString().
indexOf(
"SplitDrawer") === 0 ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0
271 property color color: Kirigami.Theme.backgroundColor
276 property Item background
278 property alias overlay: overlayRoot
293 function showPassiveNotification(
message, timeout, actionText, callBack) {
294 notificationsObject.showNotification(
message, timeout, actionText, callBack);
301 function hidePassiveNotification(index = 0) {
302 notificationsObject.hideNotification(index);
309 function applicationWindow() {
316 menuBar.parent = root.contentItem
317 if (menuBar.z === undefined) {
320 if (menuBar instanceof T.ToolBar) {
321 menuBar.position = T.ToolBar.Footer
322 }
else if (menuBar instanceof T.TabBar) {
323 menuBar.position = T.TabBar.Footer
324 }
else if (menuBar instanceof T.DialogButtonBox) {
325 menuBar.position = T.DialogButtonBox.Footer
327 menuBar.width =
Qt.binding(() => root.contentItem.width)
329 menuBar.y =
Qt.binding(() => -menuBar.height - (root.header.height ? root.header.height : 0))
333 header.parent = root.contentItem
334 if (header.z === undefined) {
337 if (header instanceof T.ToolBar) {
338 header.position = T.ToolBar.Header
339 }
else if (header instanceof T.TabBar) {
340 header.position = T.TabBar.Header
341 }
else if (header instanceof T.DialogButtonBox) {
342 header.position = T.DialogButtonBox.Header
344 header.width =
Qt.binding(() => root.contentItem.width)
345 header.y =
Qt.binding(() => -header.height)
349 footer.parent = root.contentItem
350 if (footer.z === undefined) {
353 if (footer instanceof T.ToolBar) {
354 footer.position = T.ToolBar.Footer
355 }
else if (footer instanceof T.TabBar) {
356 footer.position = T.TabBar.Footer
357 }
else if (footer instanceof T.DialogButtonBox) {
358 footer.position = T.DialogButtonBox.Footer
360 footer.width =
Qt.binding(() => root.contentItem.width)
361 footer.y =
Qt.binding(() => root.contentItem.height)
364 onBackgroundChanged: {
365 background.parent = root.contentItem
366 if (background.z === undefined) {
369 background.anchors.fill = background.parent
374 if (width > height) {
375 root.reachableMode =
false;
379 onPageStackChanged: pageStack.parent = root.contentItem;
382 LayoutMirroring.enabled:
Qt.application.layoutDirection ===
Qt.RightToLeft
383 LayoutMirroring.childrenInherit:
true
385 TP.PassiveNotificationsManager {
386 id: notificationsObject
387 anchors.bottom: parent.bottom
388 anchors.horizontalCenter: parent.horizontalCenter
394 parent: root.parent || root
400 visible: contextDrawer && contextDrawer.modal
401 parent: contextDrawer ? contextDrawer.background.parent.parent : overlayRoot
402 opacity: contextDrawer ? contextDrawer.position * 0.6 : 0
408 visible: globalDrawer && globalDrawer.modal
409 parent: globalDrawer ? globalDrawer.background.parent.parent : overlayRoot
410 opacity: globalDrawer ? globalDrawer.position * 0.6 : 0
419 globalDrawer.visible = globalDrawer.drawerOpen;
422 contextDrawer.visible = contextDrawer.drawerOpen;
431 onClicked: mouse => {
432 root.reachableMode =
false;
434 visible: root.reachableMode && root.reachableModeEnabled
437 color:
Qt.rgba(0, 0, 0, 0.3)
440 anchors.horizontalCenter: parent.horizontalCenter
442 width: Kirigami.Units.iconSizes.large
450 when: globalDrawer !== undefined && root.visible
454 restoreMode: Binding.RestoreBinding
457 when: contextDrawer !== undefined && root.visible
458 target: contextDrawer
461 restoreMode: Binding.RestoreBinding
464 implicitWidth: Kirigami.Units.gridUnit * 30
465 implicitHeight: Kirigami.Units.gridUnit * 45