[Qt-qml] Screen dimensions

Girish Ramakrishnan girish at forwardbias.in
Wed Nov 24 11:54:05 CET 2010


You can expose QDesktopWidget::screenGeometry() to the QML engine and
then access it from the QML. Something like,

engine->rootContext()->setContextProperty("screen",
QApplication::desktop()->screenGeometry());

And then screen.width and screen.height can be used in the QML.

Girish

On Wed, Nov 24, 2010 at 3:56 PM, Mark Constable <markc at renta.net> wrote:
> How would I determine the screen dimensions of the
> device being used from within QML code?
>
> Any source examples available?
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>



More information about the Qt-qml mailing list