0
votes

I have a QML Window which I want to assign contentOrientation property to Qt::LandscapeOrientation resulting in following line of code:

contentOrientation: "Qt::LandscapeOrientation"

Qt Creator shows me the following error in this code:

Invalid value for enum. (M1)

I am aware this is a very dumb error (I expect some downgrades :D), but how do I solve it?

1
Don't forget, it's Javascript, not C++, I guess you need Qt.LandscapeOrientation - folibis

1 Answers

2
votes

In QML, the enums from the C++ Qt namespace area available in the Qt.X form:

contentOrientation: Qt.LandscapeOrientation

The documentation could be clearer about this, as it still says:

The default value is Qt::PrimaryOrientation.

I imagine that this is because the values are not documented in QML to avoid duplication, and this is the only way that they can be linked to.