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. Memory management in Qt Quick
Forum Updated to NodeBB v4.3 + New Features

Memory management in Qt Quick

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.3k Views 1 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.
  • shavS Offline
    shavS Offline
    shav
    wrote on last edited by
    #1

    Hi everyone!

    Maybe my question is stupid but I can't understand how works QML properties with memory. I have the C++ object which has pointer to object as field:
    @Q_PROPERTY(MslElement* newElement READ getNewElement NOTIFY newElementChanged)
    //Getter
    inline MslElement* getNewElement(){return m_newElement;}

    //private class field
    private:
    MslElement* m_newElement;
    @

    The question: When I try to use this property like this:
    @property MslElement propertyElement: appRoot.manager.newElement@

    new object propertyElement will have a pointer to source object or it will be a new copy of source object.

    Thanks for the help.

    P.S. Where I can find some books or tutorial for memory management? Thanks.

    Mac OS and iOS Developer

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

      I am not sure, but I think in this case only the reference will be kept. QObject subclasses are not copyable, after all :)

      For a real in-depth analysis of QML engine, please read this splendid "KDAB blog":http://www.kdab.com/qml-engine-internals-part-1-qml-file-loading/ (there are several more parts in the series, I highly recommend reading them all).

      (Z(:^

      1 Reply Last reply
      0
      • shavS Offline
        shavS Offline
        shav
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1388755942"]I am not sure, but I think in this case only the reference will be kept. QObject subclasses are not copyable, after all :)

        For a real in-depth analysis of QML engine, please read this splendid "KDAB blog":http://www.kdab.com/qml-engine-internals-part-1-qml-file-loading/ (there are several more parts in the series, I highly recommend reading them all).[/quote]

        Thanks for the link! I'll look it!

        Mac OS and iOS Developer

        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