Files
launcher/qt/qml/SearchField.qml
T
Claude 74ddcfeab6 Start the Qt Quick rewrite of the launcher in qt/
A QML UI with feature parity as the goal: home grid that fills the screen with
dense packing and pinned cells, drag to reorder or into an empty cell, widget
resize handles snapping to the grid, the app drawer with search and long-press
menu, sheets, and the widget picker. HomeActivity (a QtActivity) keeps the
Android parts and hosts native widget views over the QML slots, as the WebView
shell did. A desktop backend serves the demo data, so qt/tests/e2e.cpp drives
the UI end to end offscreen; CI runs it and builds an APK that installs next to
the current launcher as ultra Home (Qt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
2026-11-02 04:40:25 +00:00

61 lines
1.8 KiB
QML

import QtQuick
// A rounded search box. Enter is "accepted"; the text is "text".
Rectangle {
id: root
property alias text: input.text
property alias placeholder: hint.text
property alias input: input
property real fontSize: 16
signal accepted()
signal escaped()
implicitHeight: 44
radius: height / 2
color: Qt.rgba(1, 1, 1, .1)
border.color: Qt.rgba(1, 1, 1, .15)
border.width: 1
function focusNow() { input.forceActiveFocus(); Qt.inputMethod.show() }
TextInput {
id: input
anchors.left: parent.left
anchors.right: clear.left
anchors.leftMargin: 20
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
color: "white"
selectionColor: Qt.rgba(1, 1, 1, .35)
font.pixelSize: root.fontSize
clip: true
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
onAccepted: root.accepted()
Keys.onEscapePressed: root.escaped()
Text {
id: hint
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
color: Qt.rgba(1, 1, 1, .6)
font.pixelSize: root.fontSize
visible: input.text.length === 0 && !input.preeditText
}
}
Text {
id: clear
anchors.right: parent.right
anchors.rightMargin: 14
anchors.verticalCenter: parent.verticalCenter
width: visible ? 20 : 0
visible: input.text.length > 0
text: "✕"
color: Qt.rgba(1, 1, 1, .7)
font.pixelSize: 14
horizontalAlignment: Text.AlignHCenter
MouseArea {
anchors.fill: parent
anchors.margins: -10
onClicked: { input.text = ""; root.escaped() }
}
}
}