[Qt-qml] Application usable area dimensions

simon.turvey at nokia.com simon.turvey at nokia.com
Mon Aug 16 13:34:24 CEST 2010


Cool. That'll work. Thanks.

Still might be useful to have more readily available though. A bit like orientation is available through the 'runtime' property when using the QML viewer.

-----Original Message-----
From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of ext Romain Pokrzywka
Sent: 16 August 2010 11:54
To: qt-qml at trolltech.com
Subject: Re: [Qt-qml] Application usable area dimensions


If you have access to the QDeclarativeEngine, you can get that information very easily by importing the QDesktopWidget from QApplication into the qml root context, e.g. :

	QApplication app(argc, argv);
	QDeclarativeView view;
	view.engine()->rootContext()->setContextProperty( "desktop", app.desktop() );

and then in your qml file e.g. :

	Rectangle {
		width: desktop.width; height: desktop.height
	}

Cheers,
Romain

--
Romain Pokrzywka | romain.pokrzywka at kdab.com | Certified Qt Software Engineer & Trainer Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions

On Monday 16 August 2010 10:54:50 simon.turvey at nokia.com wrote:
> Hi all,
>
> Rather than hard coding the screen size in my QML, is there a way of 
> retrieving the application usable area? That is, the dimensions 
> available to the application once system ui furniture has been taken into account?
>
> Regards,
>
> Simon




More information about the Qt-qml mailing list