×
Namespaces

Variants
Actions
(Difference between revisions)

Get screen coordinates in Qt

From Nokia Developer Wiki
Jump to: navigation, search
vkmunjpara (Talk | contribs)
jimgilmour1 (Talk | contribs)
m (new version 4.6 download link)
Line 1: Line 1:
{{ReviewerApproved}}
 
 
{{ReviewerApproved}}
 
{{ReviewerApproved}}
  
Line 20: Line 19:
 
==Preconditions==
 
==Preconditions==
  
* [http://pepper.troll.no/s60prereleases/ Download the latest Qt for S60 distribution from Qt].
+
* Download and Install latest version [[Qt for Symbian - Installation packages]] which has links on how to install the latest version
* 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].
+
* Go through this article: [[Getting started with Qt for S60]]
+
  
 
==Source==
 
==Source==

Revision as of 16:36, 1 November 2009

{{{width}}}
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
Symbian
Article
Keywords: QDesktopWidget::availableGeometry(), QDesktopWidget::screenGeometry()
Created: (09 Jun 2009)
Last edited: jimgilmour1 (01 Nov 2009)

Contents

Overview

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.

Preconditions

Source

QDesktopWidget* desktopWidget = QApplication::desktop();
//get client rect.
QRect clientRect = desktopWidget->availableGeometry();
 
//get application rect.
QRect applicationRect = desktopWidget->screenGeometry();


Postconditions

You will get application rect.

Screen Coordinates for 640x360

ScreenCoordinates2.JPG

Screen Coordinates for 360x640

ScreenCoordinates1.JPG

Code Example

  • The Code Example shows screen coordinates on screen and example is tested on Nokia 5800 XpressMusic.


130 page views in the last 30 days.
×