I am using Qt 5.9.3. I have following property declared in my app's main.qml
Code:
//main.qml
MyQuickItem {
property color nextColor
onNextColorChanged: {
console.log("The next color will be: " + nextColor.toString())
}
}
// MyQuickItem.h
class MyQuickItem : public QQuickItem {
}
Question:
How can I make onNextColorChanged
be defined in the C++ side?
I know that I can also make nextColor
as a property inside C++ class MyQuickItem
. like so
// MyQuickItem.h
class MyQuickItem : public QQuickItem {
Q_PROPERTY(QColor nextColor READ nextColor WRITE setNextColor NOTIFY nextColorChanged)
}
Is it possible to monitor OnNextColorChanged
inside MyQuickItem
?