Qt::CursorShape + QML
I would like to use the Qt enum CursorShape in my QML. Like this:
Unfortunately when trying to I get the following error:
bq. Error: Unknown method parameter type: Qt::CursorShape
Is there a way to register Qt::CursorShape in my QML context or do I have to reimplement my own enum ?
and what exactly is a wView object? if you register it manually you could implement a member function not using Qt::CursorShape type
bq. if you register it manually you could implement a member function not using Qt::CursorShape type
Yes I could, but I would like to use Qt::CursorShape :).
Did this workaround:
And in the C++:
@void WControllerView::setItemCursor(QGraphicsObject * object, const QString & shape)
Qt::CursorShape cursor; if (shape == "PointingHandCursor") cursor = Qt::PointingHandCursor; else cursor = Qt::ArrowCursor; object->setCursor(QCursor(cursor));
that's exactly what I meant)
Not very sexy but it works :).
well that's no to so bad. you just need to register the type like other enums in QML are registered
i've searched for it in declarative sources, and what i found is that you should use Q_ENUMS macro for registering enum type