Archived:Handle change in screen orientation in Qt
hamishwillee
(Talk | contribs) m (Add Abstract. Point to correct Qt SDK) |
|||
| Line 1: | Line 1: | ||
| − | [[Category: | + | [[Category:PIM]][[Category:Symbian C++]] |
| − | {{ReviewerApproved}} | + | {{ReviewerApproved|timestamp=20090916}} |
{{CodeSnippet | {{CodeSnippet | ||
| Line 14: | Line 14: | ||
==Overview== | ==Overview== | ||
| − | This code | + | {{Abstract|visible=true|This code example shows how to get notification when the screen mode changes using [http://doc.qt.nokia.com/stable/qwidget.html#resizeEvent QWidget::resizeEvent()]. This method gets called when the screen mode changes, so you have to implement that virtual method in your class.}} |
| − | This snippet can be self-signed | + | This snippet can be self-signed. |
==Preconditions== | ==Preconditions== | ||
| − | * Download and | + | * Download and install the [[Qt SDK]] |
| − | + | ||
| − | + | ||
==Source== | ==Source== | ||
| Line 52: | Line 50: | ||
==Download Code Example== | ==Download Code Example== | ||
| − | * | + | * [[File:QtResizeEvent.zip]] shows new screen size when user change screen mode. This example is tested on Nokia 5800 XpressMusic. |
<br> | <br> | ||
Revision as of 03:34, 26 April 2011
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: hamishwillee
(26 Apr 2011)
Contents |
Overview
This code example shows how to get notification when the screen mode changes using QWidget::resizeEvent(). This method gets called when the screen mode changes, so you have to implement that virtual method in your class.
This snippet can be self-signed.
Preconditions
- Download and install the Qt SDK
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
- File:QtResizeEvent.zip shows new screen size when user change screen mode. This example is tested on Nokia 5800 XpressMusic.

