Hi everybody!
I’m having an issue with my QtQuick / QML app.
It happens on desktop an android.
I have list of fields to be completed with data.
The fields are listed on a ListView and each one have a TextEdit Element for input.
While completing the fields one by one the list view is scrolled.
The problem is: when the TextEdit is out of the list visible area, is loose the text and it became empty again.
Here, a minimal example reproducing the described behavior.
In this example the text filled in the first fields is lost after scrolling to the bottom and get to the top again.
import QtQuick 2.2
import QtQuick.Controls 1.2
ApplicationWindow {
id: applicationWindow1
visible: true
width: 200
height: 200
title: qsTr("TextEdit on ListView Test")
ListView {
id: listView1
x: 286
width: 110
boundsBehavior: Flickable.StopAtBounds
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 0
anchors.topMargin: 0
anchors.bottom: parent.bottom
anchors.top: parent.top
clip: true
model: ListModel {
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
}
delegate: Item {
width: 100
height: 40
Rectangle {
width: 100
height: 40
color: colorCode
TextEdit {
font.pointSize: 23
anchors.fill: parent
font.bold: true
anchors.verticalCenter: parent.verticalCenter
}
}
}
}
}
Is this a bug?
Do I need to set something else to make it persistent?
Should I make copy of the text after editing finished and put it back when it became visible as a normal workflow?
Best Regards
↧