mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-29 00:05:01 +00:00
- Update 22 package metadata.json files with consistent schema - Enhance PackageLoader with file watching and navigable packages - Update QmlComponents library (atoms, core, data-display, feedback, form, layout, surfaces) - Improve watchtower PackageView and MaterialAccordion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
78 lines
2.2 KiB
QML
78 lines
2.2 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QmlComponents 1.0
|
|
|
|
Item {
|
|
id: control
|
|
|
|
property string icon: ""
|
|
property string size: "md" // sm, md, lg
|
|
property string variant: "default" // default, primary, ghost
|
|
property bool loading: false
|
|
property string tooltip: ""
|
|
|
|
signal clicked()
|
|
|
|
width: size === "sm" ? 32 : size === "lg" ? 48 : 40
|
|
height: width
|
|
|
|
Rectangle {
|
|
id: bg
|
|
anchors.fill: parent
|
|
radius: width / 2
|
|
color: {
|
|
if (!control.enabled) return "transparent"
|
|
if (mouseArea.pressed) {
|
|
switch(control.variant) {
|
|
case "primary": return Qt.darker(Theme.primary, 1.2)
|
|
default: return "#404040"
|
|
}
|
|
}
|
|
if (mouseArea.containsMouse) {
|
|
switch(control.variant) {
|
|
case "primary": return Theme.primary
|
|
default: return "#3d3d3d"
|
|
}
|
|
}
|
|
switch(control.variant) {
|
|
case "primary": return Theme.primary
|
|
case "ghost": return "transparent"
|
|
default: return Theme.surface
|
|
}
|
|
}
|
|
|
|
Behavior on color { ColorAnimation { duration: 150 } }
|
|
}
|
|
|
|
BusyIndicator {
|
|
anchors.centerIn: parent
|
|
width: parent.width * 0.5
|
|
height: width
|
|
running: control.loading
|
|
visible: control.loading
|
|
}
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: control.icon
|
|
font.pixelSize: control.size === "sm" ? 14 : control.size === "lg" ? 22 : 18
|
|
color: control.enabled ? (control.variant === "primary" ? "#ffffff" : Theme.textSecondary) : Theme.textDisabled
|
|
visible: !control.loading
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: control.clicked()
|
|
}
|
|
|
|
ToolTip.visible: tooltip && mouseArea.containsMouse
|
|
ToolTip.text: tooltip
|
|
ToolTip.delay: 500
|
|
|
|
opacity: enabled ? 1.0 : 0.5
|
|
Behavior on opacity { NumberAnimation { duration: 150 } }
|
|
}
|