Typing in the album track filter lost the keyboard on every keystroke. A qt.quick.focus trace named the thief: a fresh track delegate took focus "in scope pageFlick" right after each rebuild. In Qt 6.11 assigning a new array to ListView.model after completion runs QQuickItemViewPrivate::connectModel, which forces currentIndex to 0, and updateCurrent() then focuses delegate 0 — inside the view's focus scope, where the header's TextInput lives. `currentIndex: -1` does not survive the assignment. QbzArrayModel (a DelegateModel) now owns such arrays: a swap reaches the view as remove+insert changes, which honour currentIndex -1 and keep the rows. Because ListView re-seats inserted rows around the viewport, the model re-expresses the viewport relative to the content origin and restores it after layout; a page replacement calls scrollToTop(). The album page, the kiosk album and the kiosk playlist swap their rows on it, their ScrollMemory stores origin-relative offsets, and opening another album resets the track filter (the box mirrors `trackQuery`). scripts/test-array-model-qml.sh pins the behaviour (focus kept, viewport kept, top on request) and joins the runtime gate and CI. cc
20 lines
758 B
Bash
Executable File
20 lines
758 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# QbzArrayModel regression: a rows swap keeps the header's keyboard focus and
|
|
# the viewport (Qt 6.11 ListView.model assignment side effects). Same run in
|
|
# CI and locally.
|
|
set -euo pipefail
|
|
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
|
if [[ -n "${QT_ROOT_DIR:-}" ]]; then
|
|
qt_array_model_bins="$QT_ROOT_DIR/bin"
|
|
else
|
|
qt_array_model_qmake="${QMAKE:-}"
|
|
if [[ -z "$qt_array_model_qmake" ]]; then
|
|
qt_array_model_qmake="$(command -v qmake6 || command -v qmake)"
|
|
fi
|
|
qt_array_model_bins="$("$qt_array_model_qmake" -query QT_INSTALL_BINS)"
|
|
fi
|
|
QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software \
|
|
"$qt_array_model_bins/qmltestrunner" \
|
|
-input scripts/qml-tests/tst_array_model.qml \
|
|
-import scripts/qml-tests/imports
|