[Qt-interest] How to find full screen size

Andrew Hodgkinson ahodgkinson at endurancetech.co.uk
Sun May 24 23:44:11 CEST 2009


Ferenc Stelcz wrote:

> Kushal Das wrote:
>
>> I am showing an image full using QGraphicsView and and then calling
>> showFullScreen on the view. Now to show the image scaled to full
>> screen properly I need to find out the full screen size [...]
>
> I may be misunderstandig you, but have you tried
> QDesktopWidget::screenGeometry()/::availableGeometry() out? [...]

It's not ideal to assume that your application is on the default screen; 
I was using the following code for a while:

   QDesktopWidget * desktop   = qApp->desktop();
   int              screenNum = desktop->screenNumber();
   QRect            geometry  = desktop->availableGeometry( screenNum );
   QSize            size( geometry.width(), geometry.height() );

The "desktop->screenNumber" call returns the number of the screen in 
which the greatest portion of your application is visible.

-- 
Andrew Hodgkinson, Endurance Technology
Land line: 01223 369 408, mobile: 07855 866 780
Registered Office: 5 Marine Drive West, Bognor Regis, W. Sussex, PO21 2QA



More information about the Qt-interest-old mailing list