QML does deep copy for QVariantMap



  • In my code I need to pass data in QByteArray and QVariantMap types between objects that are instaniated in QML. I do it by declaring Q_PROPERTY inside object with data and calling a Q_INVOKABLE method of another object. It works fast with QByteArray because of implicit sharing, but I discovered that for QVariantMap QML does deep copy instead of shallow. I solved it by passing a QObject pointer and calling getter method in C++ code. However I wonder if there is a better way to do this?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.