Files
sloposk/qml/FloatingButton.qml
ericek111andClaude Opus 5.5 23e957660f Reword code comments in plain technical language
Comments only, no code changes. Replaces vague or personified phrasing
with explicit statements of what the code does and why, uses bullet
lists for multi-case behavior, and fixes the settings path in
WindowSettings.h (~/.config/sloposk/sloposk.conf).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 19:58:59 +01:00

47 lines
1.1 KiB
QML

import QtQuick
// Button shown in place of the keyboard while it is collapsed. Semi-transparent
// so it covers less. Tap emits tapped() (expand); drag emits dragStarted() and
// the parent starts the window manager's move.
Item {
id: button
signal tapped()
signal dragStarted()
opacity: 0.6
Accessible.role: Accessible.Button
Accessible.name: qsTr("Show Keyboard")
Rectangle {
anchors.fill: parent
radius: Theme.keyRadius
color: tap.pressed ? Theme.characterKey : Theme.functionKey
}
Text {
anchors.centerIn: parent
text: "⌨"
font.pixelSize: button.height * 0.4
color: Theme.text
}
TapHandler {
id: tap
// Set during a drag, so the release that ends the drag isn't treated as a tap.
property bool moved: false
onPressedChanged: if (pressed) moved = false
onTapped: if (!moved) button.tapped()
}
DragHandler {
target: null
onActiveChanged: {
if (!active)
return;
tap.moved = true;
button.dragStarted();
}
}
}