Qt: keep widgets under menus, and clear the search reliably

A sheet (the long-press menus, the widget picker) used to take every native
widget off the screen, since Qt can't draw over them. Now they stay: the
widget layer hides them below the sheet's top edge as it rises and dims
the rest like the sheet's backdrop, which takes their touches.

The search boxes ask for no suggestions, so Android keyboards type straight
in instead of composing words, and the clear button commits and clears
again once a late commit has landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
This commit is contained in:
Claude committed 2026-11-02 05:37:02 +00:00
1 parent e050f52417
commit bc37c623c8
6 files changed
+89 -16

No files matched your search

+26 -6
View File
@@ -297,12 +297,13 @@ Window {
}
// ---- telling Host where the live widget slots are
// A slot is live (its native view is shown over it) while nothing covers the home
// screen. While one is resized the others step aside, so nothing covers its handles.
// Under the open drawer the widgets stay put and the drawer's edge covers them.
// A slot is live (its native view is shown over it) unless the drawer is open. While
// one is resized the others step aside, so nothing covers its handles. Under the
// open drawer the widgets stay put and the drawer's edge covers them; under a sheet
// they stay put too, dimmed, and hidden below the sheet's edge (sheetCover).
readonly property var liveSlots: {
const out = [];
if (drawerOpen || sheet !== "") return out;
if (drawerOpen) return out;
for (let i = 0; i < home.length; i++) {
const s = home[i], b = boxOf(i);
if (s.kind !== "widget" || !b || (resizing >= 0 && i !== resizing)) continue;
@@ -314,7 +315,7 @@ Window {
property string placed: ""
function place() {
const j = JSON.stringify(liveSlots);
if (j === placed || (drawerOpen && sheet === "")) return;
if (j === placed || drawerOpen) return;
placed = j;
Host.placeWidgets(liveSlots);
}
@@ -350,6 +351,25 @@ Window {
const gy = y < 0 ? -1 : homeContent.mapToGlobal(0, y).y;
if (gy !== coverSent) { coverSent = gy; Host.coverWidgets(gy); }
}
// Native widgets under a sheet: hidden below its top edge, the rest dimmed.
readonly property var sheets: [menuSheet, itemSheet, appSheet, widgetSheet]
readonly property real sheetEdge: {
let y = 0;
for (const s of sheets) if (s.visible) y = y > 0 ? Math.min(y, s.edge) : Math.max(1, s.edge);
return y;
}
readonly property bool sheetDim: sheets.some(s => s.open)
property string sheetSent: "0,false"
function sheetCover() {
const y = sheetEdge > 0 ? homeContent.mapToGlobal(0, sheetEdge).y : 0;
const k = Math.round(y) + "," + sheetDim;
if (k === sheetSent) return;
sheetSent = k;
Host.sheetWidgets(y, sheetDim);
}
onSheetEdgeChanged: sheetCover()
onSheetDimChanged: sheetCover()
onFrameSwapped: if (uncoverPending) { uncoverPending = false; coverSent = 0; Host.coverWidgets(0); }
// ---- Host
@@ -464,7 +484,7 @@ Window {
readonly property bool isLifted: index === root.lifted
readonly property bool isResizing: index === root.resizing
readonly property bool live: Host.android && isWidget && !root.drawerOpen
&& root.sheet === "" && (root.resizing < 0 || isResizing)
&& (root.resizing < 0 || isResizing)
readonly property int row: isWidget ? -1 : (root.appRow[s.str] ?? -1)
objectName: "slot" + index
visible: b !== null
+8 -2
View File
@@ -20,11 +20,15 @@ Rectangle {
function focusNow() { input.forceActiveFocus(); Qt.inputMethod.show() }
// Empty the box, including a word still being composed, and keep typing in it.
// Android commits a composing word asynchronously, so it can land after the clear:
// clear again once it has.
function clearText() {
Qt.inputMethod.reset();
Qt.inputMethod.commit();
input.clear();
input.forceActiveFocus();
clearAgain.restart();
}
Timer { id: clearAgain; interval: 120; onTriggered: input.clear() }
TextInput {
id: input
@@ -37,7 +41,9 @@ Rectangle {
selectionColor: Qt.rgba(1, 1, 1, .35)
font.pixelSize: root.fontSize
clip: true
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
// No suggestions: Android keyboards then type straight into the box rather than
// composing words, so the list filters on every key.
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase
onAccepted: root.accepted()
Keys.onEscapePressed: root.escaped()
Text {
+2
View File
@@ -9,6 +9,8 @@ Item {
property real bottomInset: 0
property real maxWidth: 560
default property alias content: column.data
// Where the panel's top edge is, for hiding native widgets under it.
readonly property real edge: panel.y
signal closeRequested()
anchors.fill: parent
visible: open || panel.y < height