Files
bbedward ccbf1d38ad widgets: bump qml-common, rename Dank* prefixed widgets to D, add
deprecation notice to plugin compatibility shims

- When qml-common became a thing, we left qs.Widgets shims in place for
  plugin compatibility
- It's annoying to need to maintain them when qml-common has any change,
  add a warning so we can safely deprecate them in the future
- One shot rename the common stuff to D to make it shorter and nicer to
  write
2026-10-05 16:47:19 -04:00

55 lines
1.5 KiB
QML

import QtQuick
import qs.Common
import qs.DCommon.Widgets
Loader {
id: root
property string iconName: ""
property string label: ""
property color iconColor: Theme.onSecondaryContainer
property color backgroundColor: Theme.secondaryContainer
property bool tonal: true
property bool interactive: false
property bool available: true
readonly property bool hovered: item?.hovered ?? false
readonly property real glyphSize: Math.min(Theme.iconSize, width)
signal clicked
width: Theme.buttonHeightS
height: width
sourceComponent: interactive ? action : indicator
Component {
id: action
DActionButton {
buttonSize: root.width
iconName: root.iconName
iconSize: root.glyphSize
iconColor: root.iconColor
backgroundColor: !root.tonal ? "transparent" : enabled ? root.backgroundColor : Theme.onSurface_12
Accessible.name: root.label
enabled: root.available
onClicked: root.clicked()
}
}
Component {
id: indicator
Rectangle {
radius: Theme.fullRadius(width, height)
color: !root.tonal ? "transparent" : root.available ? root.backgroundColor : Theme.onSurface_12
DIcon {
anchors.centerIn: parent
name: root.iconName
size: root.glyphSize
color: root.available ? root.iconColor : Theme.onSurface_38
}
}
}
}