import QtQuick import QtQuick.Layouts import QtQuick.Controls import org.kde.kirigami as Kirigami import org.kde.plasma.core as PlasmaCore import org.kde.plasma.components as PlasmaComponents import org.kde.plasma.extras as PlasmaExtras import org.kde.plasma.plasmoid Item{ Layout.minimumWidth: govnoLayout.implicitWidth Layout.minimumHeight: Kirigami.Units.iconSizes.medium Layout.maximumWidth: govnoLayout.implicitWidth Layout.maximumHeight: Layout.minimumHeight Layout.preferredWidth: govnoLayout.implicitWidth Layout.preferredHeight: Layout.minimumHeight MouseArea { id: mouseArea //property bool wasExpanded Accessible.name: Plasmoid.title Accessible.role: Accessible.Button //Accessible.description: desc //onPressed: wasExpanded = root.expanded //onClicked: root.expanded = !wasExpanded onClicked: Plasmoid.activated(); Keys.onPressed: { switch (event.key) { case Qt.Key_Space: case Qt.Key_Enter: case Qt.Key_Return: case Qt.Key_Select: Plasmoid.activated(); break; } } // иконки не будет без этой залупы anchors.fill: parent anchors.leftMargin: 0 activeFocusOnTab: true hoverEnabled: true Component { id: meowIconComponent Kirigami.Icon { Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5 Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 Layout.alignment: Qt.AlignVCenter source: Qt.resolvedUrl("../images/dogfood.svg") isMask: true active: mouseArea.containsMouse } } Component { id: genericLabelComponent Label { property string labelText: "yaebalrot" text: labelText === "yaebalrot" ? "" : labelText color: text === "error" ? "red" : Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.mediumFont.pointSize verticalAlignment: Text.AlignVCenter } } property var configArray: Plasmoid.configuration.ExtraLayout === true ? Plasmoid.configuration.StringLayoutPlacement.split(" ") : ["meow_icon"] RowLayout { id: govnoLayout anchors.fill: parent spacing: Kirigami.Units.smallSpacing Repeater { model: mouseArea.configArray Loader { id: govnoebanoe // Logic to choose WHICH component to spawn sourceComponent: (modelData === "meow_icon") ? meowIconComponent : genericLabelComponent // Logic to pass DATA to that component Binding { target: govnoebanoe.item // The Label we just created property: "labelText" // The property on the Label value: root[modelData] // The live variable in root when: govnoebanoe.status === Loader.Ready && modelData !== "meow_icon" } Layout.fillHeight: true } } } // Kirigami.Icon { // anchors.fill: parent // source: Qt.resolvedUrl("../images/dogfood.svg") // isMask: true // active: mouseArea.containsMouse // } } }