Maintaining Dynamic QML



  • Hello, I'm using dynamic object creation with qt.createqmlobject to enable some kind of configurable UI. Basically the user of the UI can create objects to make their own custom "GUI" from my GUI which is basically their interface. I am able to create a custom GUI using the interface I have created, but when my interface shuts down, the custom "GUI" that was created by the user does not persist. I would like to be able to save the objects they have configured so that they can open their own custom created GUI (which was created using my interface) when my interface is not running. Is there a way of saving the objects they have created in some sort of file (maybe XML) so that their "GUI" can be dynamically created without the use of my interface?



  • @Amr_MKamal not having used Qt createqmlobject feature so far, I'd say save your custom GUI components as QML files (.qml and QML syntax) given the example found in the feature documentation. As suggested in this wiki page "...Practically it is inconvenient to supply a long QML string in createQmlObject() call", you may want to keep several small files (i.e. per component) instead of a big one (per whole custom GUI).



  • @Amr_MKamal Hello,

    You mean create custom GUI : writing qml code ? or selecting objects in a list and just placing / customizing and saving to be able to load it after restarting your program ?

    @Amr_MKamal said in Maintaining Dynamic QML:

    I would like to be able to save the
    objects they have configured so that they can open their own custom created
    GUI (which was created using my interface) when my interface is not
    running

    How will the user start his GUI without starting your interface ? Do you want to generate another "userGUI.exe" ?

    LA



  • @Pablo-J.-Rogina Thanks , but long or short string , my question is how to maintain these objects



  • @LeLev I mean using pre-coded objects and placing / customizing adding or deleting them and be able to load them after restarting , I don't want to start another interface but for the sake of the argument what if I do , how will that be possible , the main idea is transforming the dynamically created objects to a separate static page for say and be able to redo the process



  • @Amr_MKamal Ok, so the user will select pre-coded configurable objects and construct his GUI.
    To be able to reload that config, you can use : Local Storage QML Type or also Settings QML Type, you can also save your config in .txt file and load it with XMLHttpRequest

    Settings : http://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html
    Local Storage : http://doc.qt.io/qt-5/qtquick-localstorage-qmlmodule.html

    LA


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.