Warning, /frameworks/kirigami/examples/hero.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.12
0008 import QtQuick.Layouts 1.4
0009 import org.kde.kirigami 2.15 as Kirigami
0010 
0011 Kirigami.ApplicationWindow {
0012     id: root
0013 
0014     pageStack.initialPage: Kirigami.Page {
0015         Kirigami.Avatar {
0016             id: avvy
0017             name: "Janet Doe"
0018             anchors.centerIn: parent
0019 
0020             MouseArea {
0021                 anchors.fill: parent
0022                 onClicked: {
0023                     let page = root.pageStack.layers.push(layer)
0024                     page.hero.source = avvy
0025                     page.hero.open()
0026                 }
0027             }
0028         }
0029     }
0030 
0031     Component {
0032         id: layer
0033 
0034         Kirigami.Page {
0035             id: page
0036             title: "Oh No"
0037             property Kirigami.Hero hero: Kirigami.Hero {
0038                 destination: stackAv
0039             }
0040 
0041             Kirigami.Avatar {
0042                 id: stackAv
0043                 name: "John Doe"
0044                 width: height
0045                 height: Kirigami.Units.gridUnit * 20
0046                 anchors.centerIn: parent
0047 
0048                 MouseArea {
0049                     anchors.fill: parent
0050                     onClicked: {
0051                         page.hero.close()
0052                         root.pageStack.layers.pop()
0053                     }
0054                 }
0055             }
0056         }
0057     }
0058 }