Hi, I really need help making this plasmoid widget, and I want to make some “IconButtons” appear in a grid with different labels based on a list model. The buttons themselves are a separate QML file. Here is the spaghetti code (I know it’s very stupid) :
The main.qml:
import QtQml
import QtQuick
import org.kde.plasma.plasmoid
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
import org.kde.plasma.core as PlasmaCore
import QtQuick.Controls
import "./components" as Components
PlasmoidItem {
height : 200
width: 200
GridLayout {
columns: 3
columnSpacing: 70
ListModel {
id: labelModel
ListElement { label: "Wifi" }
ListElement { label: "Bluetooth" }
}
Repeater {
model:labelModel
delegate:Components.IconButton{
label:model.label
}
}
}
}
The IconButton.qml (inside a folder called components):
import QtQuick
import org.kde.plasma.plasmoid
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
import org.kde.plasma.core as PlasmaCore
import QtQuick.Controls
Item {
id:iconButton
required property string label
ColumnLayout {
spacing: 6
Rectangle{
radius: 60
width: 60
height: 60
color:"blue"
Kirigami.Icon {
source: "settings"
anchors.centerIn: parent
}
}
Text {
text: iconButton.label
}
}
}
the issue :
The issue is the fact that the labels don’t display at all and i cant for the love of god know what is the issue i’ve been looking all around the internet and found nothing please help , here is the output:
and thank you for reading.
