summaryrefslogtreecommitdiff
path: root/modules/controlcenter/components/ConnectedButtonGroup.qml
diff options
context:
space:
mode:
authorBora Gülerman <49169566+eratoriele@users.noreply.github.com>2026-03-15 10:42:34 +0300
committerGitHub <noreply@github.com>2026-03-15 18:42:34 +1100
commitaea2ac96ef9a6817fe9e81867da202eed4daba90 (patch)
tree8ae741a72e1c6e5dd626c40f23d9d1290effef73 /modules/controlcenter/components/ConnectedButtonGroup.qml
parentconfig: don't serialise sizes (diff)
downloadcaelestia-shell-aea2ac96ef9a6817fe9e81867da202eed4daba90.tar.gz
caelestia-shell-aea2ac96ef9a6817fe9e81867da202eed4daba90.tar.bz2
caelestia-shell-aea2ac96ef9a6817fe9e81867da202eed4daba90.zip
controlcenter/taskbar: add excludedScreens (#1215)
also changed controlcenter/components/ConnectedButtonGroup - Changed row layout to grid layout - Added optional prop: row, which defaults to 1 so it looks same as row layout if not given - added new field to options, which bypasses rootItem bind. This is needed because we can not predict the number of monitors the user has, and can not create a seperate variable for each one
Diffstat (limited to 'modules/controlcenter/components/ConnectedButtonGroup.qml')
-rw-r--r--modules/controlcenter/components/ConnectedButtonGroup.qml17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/controlcenter/components/ConnectedButtonGroup.qml b/modules/controlcenter/components/ConnectedButtonGroup.qml
index 01cd612..ab707fb 100644
--- a/modules/controlcenter/components/ConnectedButtonGroup.qml
+++ b/modules/controlcenter/components/ConnectedButtonGroup.qml
@@ -10,9 +10,10 @@ import QtQuick.Layouts
StyledRect {
id: root
- property var options: [] // Array of {label: string, propertyName: string, onToggled: function}
+ property var options: [] // Array of {label: string, propertyName: string, onToggled: function, state: bool?}
property var rootItem: null // The root item that contains the properties we want to bind to
property string title: "" // Optional title text
+ property int rows: 1 // Number of rows
Layout.fillWidth: true
implicitHeight: layout.implicitHeight + Appearance.padding.large * 2
@@ -37,10 +38,13 @@ StyledRect {
font.pointSize: Appearance.font.size.normal
}
- RowLayout {
- id: buttonRow
+ GridLayout {
+ id: buttonGrid
Layout.alignment: Qt.AlignHCenter
- spacing: Appearance.spacing.small
+ rowSpacing: Appearance.spacing.small
+ columnSpacing: Appearance.spacing.small
+ rows: root.rows
+ columns: Math.ceil(root.options.length / root.rows)
Repeater {
id: repeater
@@ -62,7 +66,10 @@ StyledRect {
// Create binding in Component.onCompleted
Component.onCompleted: {
- if (root.rootItem && modelData.propertyName) {
+ if (modelData.state !== undefined && modelData.state) {
+ _checked = modelData.state;
+ }
+ else if (root.rootItem && modelData.propertyName) {
const propName = modelData.propertyName;
const rootItem = root.rootItem;
_checked = Qt.binding(function () {