qml: silence DevConsole qmllint warnings (pragma + required property)
Qt 6.5.3's qmllint exits 255 on these two warnings even though older
qmllints only warn:
- Outer-id access from a delegate (`width: view.width`) requires
`pragma ComponentBehavior: Bound` to make the binding explicit.
- Implicit role injection (`text: model.text`) should be a
`required property`. Renamed the model role from "text" to "line"
so the required property doesn't shadow Label's own `text`.
Behaviour unchanged. Verified `make quality` from framework/skeleton
green; the framework's `php_qml_bridge_qmllint` target now lints
clean (no more warnings on DevConsole.qml).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
@@ -27,7 +29,7 @@ Rectangle {
|
|||||||
ListModel { id: lineModel }
|
ListModel { id: lineModel }
|
||||||
|
|
||||||
function append(line) {
|
function append(line) {
|
||||||
lineModel.append({ "text": line });
|
lineModel.append({ "line":line });
|
||||||
while (lineModel.count > maxLines) {
|
while (lineModel.count > maxLines) {
|
||||||
lineModel.remove(0);
|
lineModel.remove(0);
|
||||||
}
|
}
|
||||||
@@ -40,7 +42,7 @@ Rectangle {
|
|||||||
lineModel.clear();
|
lineModel.clear();
|
||||||
const tail = BackendConnection.childLogTail();
|
const tail = BackendConnection.childLogTail();
|
||||||
for (let i = 0; i < tail.length; ++i) {
|
for (let i = 0; i < tail.length; ++i) {
|
||||||
lineModel.append({ "text": tail[i] });
|
lineModel.append({ "line":tail[i] });
|
||||||
}
|
}
|
||||||
if (autoScroll.checked) {
|
if (autoScroll.checked) {
|
||||||
view.positionViewAtEnd();
|
view.positionViewAtEnd();
|
||||||
@@ -114,8 +116,10 @@ Rectangle {
|
|||||||
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
||||||
|
|
||||||
delegate: Label {
|
delegate: Label {
|
||||||
|
required property string line
|
||||||
|
|
||||||
width: view.width
|
width: view.width
|
||||||
text: model.text
|
text: line
|
||||||
color: "#d6dee7"
|
color: "#d6dee7"
|
||||||
font.family: "monospace"
|
font.family: "monospace"
|
||||||
font.pixelSize: 11
|
font.pixelSize: 11
|
||||||
|
|||||||
Reference in New Issue
Block a user