TextEdit on ListView don't keep text after scrolling.
-
Hi dasRicardo,
with the code posted by me, the problem persist in linux Qt 5.3.1 , 5.3.2 and 5.4.0(Beta) and android same versions.
I have not tested on another OS yet. -
OK, and with my code the same? I have remove the Item around the Rectangle, i have no idea why you need it?
-
I have tried your code too.
The rectangles where only for visual separation.After writing some text in all the TextEdit elements an playing a little with the scroll the content of many of them just became empty.
And the text change event is not rised when this happen.
-
I added a "video":https://www.youtube.com/watch?v=1sHKnNZLzhs of the problem.
I also tried on macosx and get the same behavior. -
Hmmm, sounds like a bug i havn't test it so massivly. Whats your goal for this construct? What's your ui idea behind this?
-
I added a video of the problem in the first post of this thread.
I also tried on macosx and get the same behavior. -
Can't reproduce this sorry, maybe graphics driver bug?
-
[quote author="dasRicardo" date="1412026473"]Hmmm, sounds like a bug i havn't test it so massivly. Whats your goal for this construct? What's your ui idea behind this?[/quote]
My goal is to make a survey app. so you define some questions. the list say question and have some space for input the data.
Like name, last name, age, address, opinion... etc etcthe real app is more complex but for the forum I just make a simple test code with the minimal elements to reproduce the problem.
-
[quote author="dasRicardo" date="1412026795"]Can't reproduce this sorry, maybe graphics driver bug?[/quote]
I think this is not a graphic driver issue, because I have same result on Mac with Nvidia graphics, suse linux with intel graphics, and various android phones and tablet from different vendors.
-
Hmm, but i think a list is the wrong component for you. Have you try to simply add some input into a flickable container and test if it produce the same result?
-
From the documentation of ListView ("http://qt-project.org/doc/qt-5/qml-qtquick-listview.html#delegate-prop":http://qt-project.org/doc/qt-5/qml-qtquick-listview.html#delegate-prop):
Note: Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's contentItem, not to the view itself. State should never be stored in a delegate.
You should map the text of your TextEdit to a property of the ListElements in your ListModel.
-
The bug is in your delegate. Documentation for ListView says:
bq. Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's contentItem, not to the view itself. State should never be stored in a delegate.
When your delegate contains a TextEdit and you don't store the edited text somewhere, it will be lost when the delegate is destroyed/recreated.
-
Thanks, for the info.
What can be a good workarround or a proper workflow for my app?
Suggestions are welcome.