The binary now links Core, Gui, Quick and QuickShapes, nothing else. Qt Widgets was there for one reason, QSystemTrayIcon, so the tray icon is gone and QApplication is back to QGuiApplication. The cat itself is the whole interface: right-click or long-press opens the settings window, which carries the tricks and a quit button. Ctrl+C in the terminal works as well. The settings window is rebuilt from Qt Quick primitives. AppButton, AppSlider, AppToggle and SettingsGroup replace the Controls types, keyboard handling and accessible roles included, and a Flickable with plain positioners replaces QtQuick.Layouts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
45 lines
1.1 KiB
QML
45 lines
1.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
|
|
// A push button built from primitives, so the app needs no Qt Quick Controls.
|
|
Rectangle {
|
|
id: button
|
|
|
|
property alias text: label.text
|
|
signal clicked()
|
|
|
|
implicitWidth: label.implicitWidth + 26
|
|
implicitHeight: 30
|
|
radius: 6
|
|
color: tap.pressed ? "#e2dcd2" : hover.hovered ? "#efeae1" : "#f7f4ee"
|
|
border.width: button.activeFocus ? 2 : 1
|
|
border.color: button.activeFocus ? "#4d7ea8" : "#d8d2ca"
|
|
antialiasing: true
|
|
activeFocusOnTab: true
|
|
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: label.text
|
|
Accessible.onPressAction: button.clicked()
|
|
|
|
Text {
|
|
id: label
|
|
anchors.centerIn: parent
|
|
color: "#2f2a36"
|
|
font.pixelSize: 13
|
|
}
|
|
|
|
HoverHandler { id: hover }
|
|
|
|
TapHandler {
|
|
id: tap
|
|
onTapped: button.clicked()
|
|
}
|
|
|
|
Keys.onPressed: function(event) {
|
|
if (event.key === Qt.Key_Space || event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
button.clicked()
|
|
event.accepted = true
|
|
}
|
|
}
|
|
}
|