Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Serialization
Forum Update on Monday, May 27th 2025

QML Serialization

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 4.3k 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.
  • F Offline
    F Offline
    Fenix Voltres
    wrote on 6 Apr 2011, 12:54 last edited by
    #1

    I have to serialize whole scene rendered with QDeclarativeView, what's the best approach?
    Do I have to write it from a scratch?

    When temptation brings me to my knees
    And I lay here drained of strength
    Show me kindness
    Show me beauty
    Show me truth

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 6 Apr 2011, 14:03 last edited by
      #2

      Could you go into a bit more detail on what you want to achieve?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fenix Voltres
        wrote on 6 Apr 2011, 14:32 last edited by
        #3

        Sure:

        I have a QML application in which I create 2D boxes (Rectangles) - each box can be opened and contain other boxes and so on - now I need to save the whole box-tree into a file, so I could load and reuse it later.
        I couldn't find anything about serialization in QML - do I have to write own parser in C++ which would read my QML tree or is there any easier way?

        When temptation brings me to my knees
        And I lay here drained of strength
        Show me kindness
        Show me beauty
        Show me truth

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 6 Apr 2011, 14:45 last edited by
          #4

          It is very hard to give sound advice on this, because I have no clue how your app works internally. My first instinct would be to keep track of the state of your rects outside of QML.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            frankcyblogic.de
            wrote on 6 Apr 2011, 15:53 last edited by
            #5

            I think you have to write from scratch. There is a QDataStream class in Qt which helps creating your own binary serialization. I think most basic Qt types support QDataStream. Check out QObject::children() and QDeclarativeView::rootObject. Goot luck, would be nice to hear about your solution.

            1 Reply Last reply
            0

            1/5

            6 Apr 2011, 12:54

            • Login

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