qml orientation animation
i started working with qml and got a problem.
i like to animate my ui when the sreenorientation changes. but without black screen.
i have googled a lot, but i can’t get it working.
i tried to do it like the first comment on this [developer.nokia.com] site says.
But i cant get it working because the connect is not possible with my qmlapplicationviewer.
How can i connect a signal of my qmlapplicationviewer to a function in my main.qml?
Thanks in advance!
ok, i was able to connect the signal to a function.
but now i have another problem.
i created a new class inheriting QDeclarativeView. This class should send a signal when its resizeEvent() is called. but that never happens without showing it. But when i show it i can’t see my viewer, so there is an empty screen. i also tried to set its stylesheet transparent, but then the screen is white.
How can i show “viewer” and let “my” run the resizeEvent on switching the phone?
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
- MyClass my;
- return app->exec();
I don’t want to get into your code too much, but I can tell you how I did it. A simple, yet powerful solution, totally OS independent.
In my main QML file, I set height and width by reading a property from C++. This property is being updated by a slot that is connected to QWidget::resize() (in this case, that would be QDeclarativeView::resize()).
Also, you’ll need to set this: viewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);