QML orientation observer: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 16:34, 14 January 2015

In one of my mobile QML applications, I need to know when the handset orientation changes. The runtime knows but it doesn’t offer a signal to my code. Here is a QML hack that observes when orientation changes. It watches both height and width for changes. When they have both changed, it sets a boolean property to ‘true’. This works on handsets because both height and width change when orientation changes. It probably won’t work on a desktop because there it’s easy to change one without the other.

Categories: