The two log write will retrieve the property individually, if the value changes in between then the two values will be different.
No. Not from the reader function in c++ if you meant that. Just to be sure i put std::cerr over there like this:
QObject* name3
() const { std
::cerr <<
"Property read." << std
::endl;
return m_pName3;
}
QObject* name3() const { std::cerr << "Property read." << std::endl; return m_pName3;}
To copy to clipboard, switch view to plain text mode
And this i have put everywhere in all classes involved. Reading QML's objName3 will never invoke any property reader function written in c++. That is the difference between for instance:
property QtObject objName
Component.onCompleted: objName = objRoot.name
property QtObject objName
Component.onCompleted: objName = objRoot.name
To copy to clipboard, switch view to plain text mode
and somewhere else:
console.log(objRoot.name) //--> this WILL invoke the c++ property reader function
console.log(objName) //--> this WILL NEVER inovke the property reader function
console.log(objRoot.name) //--> this WILL invoke the c++ property reader function
console.log(objName) //--> this WILL NEVER inovke the property reader function
To copy to clipboard, switch view to plain text mode
and further if you have:
onObjNameChanged: console.log(objName)
onObjNameChanged: console.log(objName)
To copy to clipboard, switch view to plain text mode
you will see it being printed when Component.onCompleted above assigned to it, which is understandable and everyone agrees BUT also when delete m_pName in c++ is done. In this case onObjNameChanged will be called again and will print null.
I hope i have been able to describe it properly this time.
Every Qt installation comes with the Qt source code
hehe..i consider myself too much of a newbie to do that.
Bookmarks