Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to dynamic split my custom window and save or restore those child



  • Hi all Qters

    Implementation dynamic window split like the following image:

    split-window

    so i want to save those child windows and when app start in next ,it can be restore like it,

    My idea is like this:

    I split the window is OK,and save the qobject-tree in my local xml ,just like this:

    <?xml version="1.0" encoding="UTF-8" ?>
      <QWidget>
     <QSplitter id="1">
           <QLineEdit>John</QLineEdit>
       </QSplitter>
       <QSplitter id="2">
           <QLineEdit text='myusername'>Jane</QLineEdit>
       </QSplitter>
       <QSplitter id="3">
           <CustomWidget code ='AAPL'>Apple Stock</CustomWidget>
       </QSplitter>
    </QWidget>
    
    

    I want to parse this xml to create those children

    Someone to help me?
    Thank you!


  • Lifetime Qt Champion


  • Qt Champions 2017

    If your idea is to restore the windows when you closed the application, you can try saving all the windows sizes and text entered using the QSettings and restore them when you open your application. You need to every piece of information using QSettings.



  • @jsulm Thank you
    I use xmlstreamwrite to save those children and its's data
    so i need to use xmlstreamread to parse and recursive to create it



  • @dheerendra Hi
    the follow codes:

       //Implementation this function  for every your custom object
       void save(QDataStream& out);
       void restore(QDataStream& in);
    

Log in to reply