ChoiceChip.qml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import "." as Components
  4. // Selectable pill chip — the one way any option is picked in this UI
  5. // (clear modes, LED effects, timeouts, pause lengths, ...).
  6. Rectangle {
  7. id: chip
  8. property string label: ""
  9. property bool selected: false
  10. signal clicked()
  11. implicitHeight: 44
  12. radius: height / 2
  13. color: selected ? Components.ThemeManager.accentSoft
  14. : (chipArea.pressed ? Components.ThemeManager.pressedColor : "transparent")
  15. border.width: 1
  16. border.color: selected ? Components.ThemeManager.accent
  17. : Components.ThemeManager.borderColor
  18. Label {
  19. anchors.centerIn: parent
  20. width: parent.width - Components.ThemeManager.spaceMd
  21. text: chip.label
  22. font.family: Components.ThemeManager.fontMedium
  23. font.pixelSize: 13
  24. color: chip.selected ? Components.ThemeManager.accent
  25. : Components.ThemeManager.textSecondary
  26. elide: Text.ElideRight
  27. horizontalAlignment: Text.AlignHCenter
  28. }
  29. MouseArea {
  30. id: chipArea
  31. anchors.fill: parent
  32. onClicked: chip.clicked()
  33. }
  34. }