[Qt-qml] Application usable area dimensions

Romain Pokrzywka romain.pokrzywka at kdab.com
Mon Aug 16 12:54:11 CEST 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2396 bytes
Desc: not available
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100816/41be5fd9/attachment.bin 


More information about the Qt-qml mailing list