I would like to write a QML Extension using only Python. I know how to do this in C++, but not in Python. Is this even possible? Here’s a vague idea of what I’m looking for.
class NewToQML(QObject):
Q_PROPERTY(int root READ num WRITE setNum NOTIFY numChanged REVISION 1)
And in test.qml:
import MyQmlAdditions 1.0
NewToQML {
num: 7;
}
[edit]
I would like to use this QML addition to accomplish for instance changing the cursor when the mouse is over the graphical object (NewToQML).
I found the answer a while back on nabble answered by Phil Thompson-5 with a good explanation/reasoning following by Giovanni Bajo.
Short answer: PyQt does not support qmlRegisterType as of 4.7 and earlier versions.
However, PySide does have this functionality as shown here.