Unsolved The window does not remove the data when closed
-
When close a dialog window box and open again the new window does not clear the last written item. I wish that the dialog text input should clean.
-
@Sergei_Rack More information:
![alt text]( image url) -
Hi,
Please don't post the same question in multiple sub-forum. One is enough.
Closed the duplicate.
-
@Sergei_Rack As you are probably aware, an important of dialog design is how and when to initialise it. An API like Qt cannot know how you want to do this automatically so you must do it yourself in the appropriate way at the appropriate time. Such as in the constructor or an initialiser function or at the place you create it just before you call exec() or show().
-
@Sergei_Rack 2 ways to deal with this...
-
Clear your form widgets when you open the window. QML tends to keep "widgets" in memory so showing and hiding the window doesn't destroy it like when using QtWidgets and C++. So therefore it's more like an always allocated dialog that shows and hides. Make sure to reset everything before use.
-
Go with a dynamically allocate window that you delete when done, then it will allocate a fresh one on next open. This should help with that:
http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html
-