Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to dynamic split my custom window and save or restore those child
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TobyYiT Offline
    TobyYiT Offline
    TobyYi
    wrote on last edited by
    #1

    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!

    将QtCoding进行到底,做Qt的宠儿
    关注移动互联网,关注手机助手
    开发即时通讯,服务于金融行业
    My github :https:&#x2F;&#x2F;github.com&#x2F;toby20130333

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi!
      You can start with http://doc.qt.io/qt-5/qxmlstreamreader.html#details

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      TobyYiT 1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        TobyYiT 1 Reply Last reply
        5
        • jsulmJ jsulm

          Hi!
          You can start with http://doc.qt.io/qt-5/qxmlstreamreader.html#details

          TobyYiT Offline
          TobyYiT Offline
          TobyYi
          wrote on last edited by
          #4

          @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

          将QtCoding进行到底,做Qt的宠儿
          关注移动互联网,关注手机助手
          开发即时通讯,服务于金融行业
          My github :https:&#x2F;&#x2F;github.com&#x2F;toby20130333

          1 Reply Last reply
          0
          • dheerendraD dheerendra

            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.

            TobyYiT Offline
            TobyYiT Offline
            TobyYi
            wrote on last edited by
            #5

            @dheerendra Hi
            the follow codes:

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

            将QtCoding进行到底,做Qt的宠儿
            关注移动互联网,关注手机助手
            开发即时通讯,服务于金融行业
            My github :https:&#x2F;&#x2F;github.com&#x2F;toby20130333

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved