Qt::CursorShape + QML
-
Greetings Trolls,
I would like to use the Qt enum CursorShape in my QML. Like this:
@Component.onCompleted: {
wView.setItemCursor(buttonMenuMouse, Qt.PointingHandCursor);
}@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 ?
Thanks.
B.A.
-
Did this workaround:
@Component.onCompleted: {
wView.setItemCursor(boxMouseArea, "PointingHandCursor");
}@And in the C++:
@void WControllerView::setItemCursor(QGraphicsObject * object, const QString & shape)
{
Q_ASSERT(object);Qt::CursorShape cursor; if (shape == "PointingHandCursor") cursor = Qt::PointingHandCursor; else cursor = Qt::ArrowCursor; object->setCursor(QCursor(cursor));
}@