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. Does really property var mdl: model copies the full model object in memory?
Forum Update on Monday, May 27th 2025

Does really property var mdl: model copies the full model object in memory?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlpropertiesproperty
4 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.
  • K Offline
    K Offline
    Kofr
    wrote on 13 May 2016, 07:28 last edited by
    #1

    Hello guys,
    I faced with this issue that I have to pass forward some data from one QML component to another and thus I created property var mdl: model when model here is quite heavy object.
    Does QtQuick really copies this in memory or how does it works? and what is the difference with property alias?

    P 1 Reply Last reply 13 May 2016, 07:40
    0
    • K Kofr
      13 May 2016, 07:28

      Hello guys,
      I faced with this issue that I have to pass forward some data from one QML component to another and thus I created property var mdl: model when model here is quite heavy object.
      Does QtQuick really copies this in memory or how does it works? and what is the difference with property alias?

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 13 May 2016, 07:40 last edited by p3c0
      #2

      Hi @Kofr,
      It is documented here. From the doc:

      Property aliases are properties which hold a reference to another property. Unlike an ordinary property definition, which allocates a new, unique storage space for the property, a property alias connects the newly declared property (called the aliasing property) as a direct reference to an existing property (the aliased property).

      So what I understand from it is that the first assignment (in your example) will copy into a new object while aliases holds the reference.

      157

      K 1 Reply Last reply 13 May 2016, 13:36
      0
      • P p3c0
        13 May 2016, 07:40

        Hi @Kofr,
        It is documented here. From the doc:

        Property aliases are properties which hold a reference to another property. Unlike an ordinary property definition, which allocates a new, unique storage space for the property, a property alias connects the newly declared property (called the aliasing property) as a direct reference to an existing property (the aliased property).

        So what I understand from it is that the first assignment (in your example) will copy into a new object while aliases holds the reference.

        K Offline
        K Offline
        Kofr
        wrote on 13 May 2016, 13:36 last edited by Kofr
        #3

        @p3c0 so model in example is a model defined in C++ and instantiated in QML.
        The question is
        Does QML makes copy of this object (2 data models in memory) or it keeps only reference.
        is it ducumented somewhere?

        ? 1 Reply Last reply 13 May 2016, 13:40
        0
        • K Kofr
          13 May 2016, 13:36

          @p3c0 so model in example is a model defined in C++ and instantiated in QML.
          The question is
          Does QML makes copy of this object (2 data models in memory) or it keeps only reference.
          is it ducumented somewhere?

          ? Offline
          ? Offline
          A Former User
          wrote on 13 May 2016, 13:40 last edited by
          #4

          @Kofr Hi! If you want to be really sure (because you don't trust the docs or your code ^_^) then add something like qDebug() << "hello"; to the destructor of the model and see how often that's called.

          1 Reply Last reply
          0

          2/4

          13 May 2016, 07:40

          • Login

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