Anyways to store int or double by reference within QVariant?
-
Hello, I'm still trying to learn Qt. In my project I have a QVariantMap that my qml will be accessing. The values for each key are QVariants of int values. As I understand it, when it comes to primitives like int or double, QVariant will store the value rather than the reference. This is problematic because those int values come from another one of my classes members. So when the other class changes its values, it will not be reflected in my QVariantMap because it just made a copy of them rather than a reference to them.
Am I understanding this correctly? If so, is there any way to get QVariant to store primitives like int or double by reference rather than value?
-
Hello, I'm still trying to learn Qt. In my project I have a QVariantMap that my qml will be accessing. The values for each key are QVariants of int values. As I understand it, when it comes to primitives like int or double, QVariant will store the value rather than the reference. This is problematic because those int values come from another one of my classes members. So when the other class changes its values, it will not be reflected in my QVariantMap because it just made a copy of them rather than a reference to them.
Am I understanding this correctly? If so, is there any way to get QVariant to store primitives like int or double by reference rather than value?
@learis said in Anyways to store int or double by reference within QVariant?:
Am I understanding this correctly?
Yes, and there is no way to store references in a QVariant.