Files
qbz/crates/qbz-qt/qml/controls/QbzLineEdit.qml
T
vicrodh 9a4fec6b70 refactor(qbz-qt): phase 23 part 1 — QML module layout + first five domain bridges
Two fronts of the modularization, both gated green before this commit.

QML leaves the flat qml/ directory for seven modules: cards, controls,
rows, settings, shell, theme, views. Only Main.qml and LoginScreen.qml
stay at the root. build.rs matches the tree exactly (55 files), relative
imports and asset paths were re-anchored for the new depth.

The QbzBridge God-object starts breaking up: QbzSession, QbzShell,
QbzPlayer, QbzQueue and QbzHome are now their own #[cxx_qt::bridge]
singletons, each with its own OnceLock<CxxQtThread> and ui() hop, booted
in order from Main.qml. Bridge files stay directly under src/ because
cxx-qt-build only accepts rust_files from one directory (QTBUG-93443).

bridge.rs keeps 5.5 domains (library, album/artist, settings,
integrations, search, playlist) and dies once they are split out.

cc
2026-07-28 11:08:20 -06:00

59 lines
1.7 KiB
QML

// QbzLineEdit (std-widgets LineEdit, settings styling) — extracted from
// SettingsView.qml in phase 19. 240px / 34px elevated r8 bordered input;
// commits on Enter AND on focus loss (the Tauri onchange semantics —
// PlaybackSettings.slint).
import QtQuick
import com.blitzfc.qbz
import "../theme"
Rectangle {
property string text: ""
property string placeholder: ""
property bool isPassword: false
signal committed(string value)
QbzTheme { id: theme }
width: 240
height: 34
radius: theme.radiusSm
border.width: 1
border.color: theme.borderSubtle
color: theme.surfaceElevated
TextInput {
id: input
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
color: theme.textPrimary
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
clip: true
echoMode: parent.isPassword ? TextInput.Password : TextInput.Normal
text: parent.text
onAccepted: parent.committed(text)
onActiveFocusChanged: if (!activeFocus) parent.committed(text)
// External republish (e.g. Reset) re-seeds the field while it is
// not being edited.
Binding {
target: input
property: "text"
value: input.parent.text
when: !input.activeFocus
}
}
Text {
visible: input.text === ""
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
text: placeholder
color: theme.textMuted
font.pixelSize: theme.fontBody
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}