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. Dynamic create and delete Object
QtWS25 Last Chance

Dynamic create and delete Object

Scheduled Pinned Locked Moved QML and Qt Quick
qml dynamic
4 Posts 2 Posters 1.4k 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.
  • K Offline
    K Offline
    kDohmen
    wrote on last edited by
    #1

    Hello,

    I want to create, store and delete Qml-Objects (like http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html).

    My Question ist:
    I pass and store the created Object in C++. Can I delete the passed object without memoryleak or do I have to delete the object in Qml (like in the tutorial)?

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

      I think you can delete in C++, especially if you have created the object in C++, too.

      (Z(:^

      K 1 Reply Last reply
      0
      • sierdzioS sierdzio

        I think you can delete in C++, especially if you have created the object in C++, too.

        K Offline
        K Offline
        kDohmen
        wrote on last edited by
        #3

        @sierdzio I create the object in qml and pass it to C++. Is it realy save? No memoryleak or problems with Threads?

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

          Check with valgrind to be sure, but I think it is OK (use deleteLater() or destroy() method: link).

          (Z(:^

          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