Giter VIP home page Giter VIP logo

Comments (5)

filcuc avatar filcuc commented on September 1, 2024

QVariant::voidPointer return the address of the QVariant created in C++ not the pointer of the QObject inside the QVariant.

from dqml.

filcuc avatar filcuc commented on September 1, 2024

Currently QVariant don't have a getter for obtaining the QObject* pointer inside it. The reason is that is very simple to make error with a garbage collected language like D. The QObject contained the QVariant could be owned from C++ for example or from Qml.

from dqml.

filcuc avatar filcuc commented on September 1, 2024

Please explain your use case in order to find a better approach or workaround/solution

from dqml.

JoeKays avatar JoeKays commented on September 1, 2024

Ah, I get it. That's a bit misleading, though.
But it's indeed dangerous in garbage collected languages most of the time.

In my case however the QObject is a custom QObject I made with D and passed to the QML using a QtSignal() and the Connection { } component in qml. That means that the object is actually owned by the D code already.

For my use case this object contains info about the data that is shown in the qml user interface. When the item is selected, some operations on the data of the object should be done for which a reference to the object is required.
Do you have any idea how to achieve that, other than storing the objects in a map with some identifier? Because that's the only solution I can think of right now and that's ugly, because the data objects are not ordered and I would have to compute a random identifier to pass to the qml then.

from dqml.

filcuc avatar filcuc commented on September 1, 2024

from dqml.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.