Files
mxandClaude Opus 5.5 7f1189606c Place Control Center tiles freely and host plugin widgets as tiles
Tiles keep the cell they are dropped in, so gaps stay where they are
left; moving or resizing onto other tiles pushes those straight down.
Enabled plugins with a Noctalia controlCenterWidget entry point are
offered as tiles in edit mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 22:02:18 +02:00

53 lines
2.0 KiB
QML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
pragma ComponentBehavior: Bound
import QtQuick
import "../theme"
// Control Center grid tile. Modules fill their cells and adapt to `cols` ×
// `rows` (1–4 each). A module can extend below its cells (`extraHeight`, e.g.
// per-app volume); the grid moves the tiles underneath down to make room.
// Outside the grid (Settings pages) it is a 4×1 tile that grows the same way.
Item {
id: root
default property alias content: body.data
// Config id of this tile; the grid sets it (plugin tiles need it).
property string moduleId
property int cols: 4
property int rows: 1
// Height of the cells, without the extension; the grid sets it.
property real baseHeight: rows * 68 + (rows - 1) * 10
// Height wanted below the cells while extended; 0 when not.
property real extraHeight: 0
property bool expanded: false
// 1×1 toggles draw as a circle centred in their cell.
property bool round: false
property bool hovered: false
property color color: hovered ? Theme.hover : Theme.fill
readonly property bool compact: cols === 1 && rows === 1
readonly property bool wide: cols >= 2
readonly property bool tall: rows >= 2
readonly property bool circle: round && compact && extraHeight <= 0
readonly property alias background: bg
implicitWidth: 360
implicitHeight: baseHeight + (extraHeight > 0 ? extraHeight + 10 : 0)
Rectangle {
id: bg
readonly property real d: Math.min(root.width, root.baseHeight)
x: root.circle ? (root.width - d) / 2 : 0
width: root.circle ? d : root.width
height: root.circle ? d : root.height
radius: root.circle ? d / 2 : Math.min(30, root.baseHeight / 2, root.width / 2)
color: root.color
border.width: 1
border.color: Theme.hairline
Behavior on color {
ColorAnimation {
duration: Theme.duration / 2
}
}
}
Item {
id: body
anchors.fill: parent
}
}