Archived:Handle change in screen orientation in Qt
S60 5th Edition
This code snippets shows how to get notification screen mode from portrait to landscape and vide-versa. Sometime we need to resize our custom control with change in screen mode. Basically QWidget::resizeEvent() get called when user change screen mode, so you have to implement that virtual method in your class.
This snippet can be self-signed. As it does not use any API which require developer/symbian signed certificate.
- Download Qt for S60 Garden release from here: Qt for S60 "Garden" pre-release
- Install Qt for S60:Installing Qt on S60
- Check this link for installation guide: How to install the package.
- Go through this article: Getting started with Qt for S60
//resizeEvent() method get called when user change screen mode.
void ResizeEvent::resizeEvent (QResizeEvent* event)
QSize widgetSize = event->size();
//Resize your custom control according to new size.
The code snippet is expected to notify change in screen mode.
Download Code Example
- The Code Example show new screen size when user change screen mode. This example is tested on Nokia 5800 XpressMusic.