Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/test-fixtures/ui/qt-focus.qml

Raw
import QtQuick
import QtQuick.Window

// Diagnostic control: no Nuguland imports, Quickshell surfaces or services.
// Run only inside the sanctioned nested compositor: just ui-test qt-focus.
Window {
    id: window

    visible: true
    width: 360
    height: 160
    title: "qt focus control"
    color: "#202020"
    readonly property bool editorFirst: Qt.application.arguments.indexOf("--editor-first") >= 0
    onActiveChanged: console.log("qt-focus:window-active=" + active)

    Item {
        id: plain

        anchors.fill: parent
        focus: !window.editorFirst
        KeyNavigation.tab: editor
        onActiveFocusChanged: console.log("qt-focus:plain=" + activeFocus)

        Text {
            anchors.centerIn: parent
            color: "white"
            text: "non-editable focus; tab to editor"
        }
    }

    TextInput {
        id: editor

        x: 20
        y: 120
        width: 320
        height: 30
        color: "white"
        focus: window.editorFirst
        KeyNavigation.backtab: plain
        onActiveFocusChanged: console.log("qt-focus:editor=" + activeFocus)
        onTextChanged: console.log("qt-focus:typed=" + (text === "probe"))
    }
}