Warning, /plasma/libplasma/examples/applets/compactrepresentation/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
0003 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004
0005 SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.plasma.components as PlasmaComponents
0012 import org.kde.plasma.extras as PlasmaExtras
0013 import org.kde.plasma.plasmoid
0014
0015 PlasmoidItem {
0016 id: root
0017
0018 Plasmoid.title: "Representations Example"
0019
0020 switchWidth: Kirigami.Units.gridUnit * 10
0021 switchHeight: Kirigami.Units.gridUnit * 10
0022
0023 compactRepresentation: MouseArea {
0024 property bool wasExpanded
0025
0026 Accessible.name: Plasmoid.title
0027 Accessible.role: Accessible.Button
0028
0029 Layout.minimumWidth: Kirigami.Units.gridUnit * 3
0030 Layout.minimumHeight: Kirigami.Units.gridUnit * 3
0031
0032 onPressed: wasExpanded = root.expanded
0033 onClicked: root.expanded = !wasExpanded
0034
0035 PlasmaComponents.Label {
0036 anchors.fill: parent
0037 horizontalAlignment: Text.AlignHCenter
0038 verticalAlignment: Text.AlignVCenter
0039 wrapMode: Text.Wrap
0040 text: i18n("Click me")
0041 }
0042 }
0043
0044 fullRepresentation: PlasmaExtras.Representation {
0045 Layout.preferredWidth: Kirigami.Units.gridUnit * 20
0046 Layout.preferredHeight: Kirigami.Units.gridUnit * 20
0047
0048 Layout.minimumWidth: root.switchWidth
0049 Layout.minimumHeight: root.switchHeight
0050
0051 header: PlasmaExtras.BasicPlasmoidHeading {}
0052 contentItem: PlasmaComponents.ScrollView {
0053 contentWidth: availableWidth
0054 PlasmaExtras.Heading {
0055 anchors.fill: parent
0056 topPadding: Kirigami.Units.gridUnit * 2
0057 bottomPadding: Kirigami.Units.gridUnit * 2
0058 horizontalAlignment: Text.AlignHCenter
0059 verticalAlignment: Text.AlignVCenter
0060 wrapMode: Text.Wrap
0061 text: i18n("Hello world")
0062 }
0063 }
0064 }
0065 }