Get screen coordinates in Qt
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 not use any API which require signing.
- 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
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.