Get screen coordinates in Qt
m (new version 4.6 download link)
|Line 1:||Line 1:|
|Line 20:||Line 19:|
* Download latest [[Qt ]] to install the
Revision as of 16:36, 1 November 2009
S60 5th Edition
This code snippets shows how to get screen coordinates/screen size in application. The API QDesktopWidget::screenGeometry() returns the application rect (screen size of device) and API QDesktopWidget::availableGeometry() returns client rect (screen size minus status pane). It is useful in UI applications that do not use layout managers by implementing virtual QWidget::resizeEvent().
This snippet can be self-signed. As it does not use any API which require developer/symbian signed certificate.
- Download and Install latest version Qt for Symbian - Installation packages which has links on how to install the latest version
QDesktopWidget* desktopWidget = QApplication::desktop();
//get client rect.
QRect clientRect = desktopWidget->availableGeometry();
//get application rect.
QRect applicationRect = desktopWidget->screenGeometry();
You will get application rect.
- The Code Example shows screen coordinates on screen and example is tested on Nokia 5800 XpressMusic.