Archived:Handle change in screen orientation in Qt
m (Corrected typo) |
m |
||
| Line 17: | Line 17: | ||
==Preconditions== | ==Preconditions== | ||
| − | * [http://pepper.troll.no/s60prereleases/ Download the latest Qt for S60 distribution from Qt | + | * [http://pepper.troll.no/s60prereleases/ Download the latest Qt for S60 distribution from Qt]. |
* Install Qt for S60:[[Installing Qt on S60]] | * Install Qt for S60:[[Installing Qt on S60]] | ||
* Check this link for installation guide: [http://pepper.troll.no/s60prereleases/doc/install-s60.html How to install the package]. | * Check this link for installation guide: [http://pepper.troll.no/s60prereleases/doc/install-s60.html How to install the package]. | ||
Revision as of 15:18, 12 August 2009
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
S60 5th Edition
Article
Keywords: QWidget::resizeEvent()
Created: (26 Jun 2009)
Last edited: lpvalente
(12 Aug 2009)
Contents |
Overview
This code snippets shows how to get notification screen mode from portrait to landscape and vise-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.
Preconditions
- Download the latest Qt for S60 distribution from Qt.
- 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
Source
//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.
QMainWindow::resizeEvent(event);
}
Postconditions
The code snippet is expected to notify change in screen mode.
Screen after changing mode to portrait
Related link
Download Code Example
- The Code Example show new screen size when user change screen mode. This example is tested on Nokia 5800 XpressMusic.

