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. Generate Qml-String from QObject
Forum Updated to NodeBB v4.3 + New Features

Generate Qml-String from QObject

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 354 Views 2 Watching
  • 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.
  • DabullaD Offline
    DabullaD Offline
    Dabulla
    wrote on last edited by
    #1

    Are there any sources where this has been done? I think QtCreator does it with the designer, it would be great if I could use Qt itself for this task.
    I want to serialize all Q_PROPERTIES of QObjects and the Object itself in a qml file.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Here is a code I wrote years ago to do just that: https://github.com/sierdzio/closecombatfree/blob/master/src/ccfgamemanager.cpp#L104

      It takes QObjects from QML engine, and saves all properties into a file (QML file).

      (Z(:^

      1 Reply Last reply
      5
      • DabullaD Offline
        DabullaD Offline
        Dabulla
        wrote on last edited by
        #3

        Thanks for the Code :). I might do it similar to that and it does not really look like rocket science. Maybe QDate will be difficult to write. Maybe I can use JSON.stringify(...).

        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