[Qt-qml] Application usable area dimensions
Jason H
scorp1us at yahoo.com
Thu Aug 19 17:59:09 CEST 2010
-- I hit send too soon --
"By setting the resize mode of the QDeclarativeView to SizeRootObjectToView,
the top-level item is automatically resized to the window size. In the worst
case, this is exactly what you are asking for except that you need an extra
Item. In the common case, i.e. in both examples here so far, The current
behavior give you what you want without even the extra lines. It is not the
behavior of QmlViewer though, and so you will need your own application.
Perhaps what you really want is to have a command line flag for QmlViewer which
makes it act like this?
If your suggestion actually means the window size, and not the widget size,
then that would need a very separate solution for the case where the
QDeclarativeView is not the top-level widget (and the current solution is fine
for the case where it is)."
The problem is that with the current scenario, the first item does not know its
allocated size. We want to be able to READ it. Writing it blindly is not
acceptable. What if the root item doesn't care, and only wants to size itself
relative to the allocated dimensions?
By having parent, we can see how many pixels are available, so that we can scale
items to the view rect. Or, by having a parent, we can use parent anchors ont
he right or bottom for tool bars. (We ca guess zero in other cases)
It makes it easier to deal with various resolution devices, without having to
write QML screens hand-adjusted for every one.
________________________________
From: "henrik.hartz at nokia.com" <henrik.hartz at nokia.com>
To: simon.turvey at nokia.com
Cc: scorp1us at yahoo.com; qt-qml at trolltech.com
Sent: Wed, August 18, 2010 5:18:44 AM
Subject: Re: [Qt-qml] Application usable area dimensions
http://bugreports.qt.nokia.com/browse/QTBUG-12967
On Aug 18, 2010, at 9:21 AM, Turvey Simon (Nokia-MS/London) wrote:
Gosh, that's a lovely idea.
>
>+1
>
>-----Original Message-----
>From: ext Jason H [mailto:scorp1us at yahoo.com]
>Sent: 17 August 2010 15:48
>To: Hartz Henrik (Nokia-MS-Qt/Oslo); Turvey Simon (Nokia-MS/London)
>Cc: qt-qml at trolltech.com
>Subject: Re: [Qt-qml] Application usable area dimensions
>
>Wouldn't it make sense to just have an implicit parent that is the window size?
>
>So in QML:
>Rect {
>width: parent.width
>height: parent.height
>}
>
>
>
>
>----- Original Message ----
>From: "henrik.hartz at nokia.com" <henrik.hartz at nokia.com>
>To: simon.turvey at nokia.com
>Cc: qt-qml at trolltech.com
>Sent: Mon, August 16, 2010 2:01:51 PM
>Subject: Re: [Qt-qml] Application usable area dimensions
>
>Hi,
>
>you're not looking for
>http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeview.html#ResizeMode-enum
>(potentially combined with QWidget::showFullscreen) by any chance? this is what
>qmlviewer (potentially with -fullscreen) also does for you.
>
>Cheers,
>Henrik
>
>On Aug 16, 2010, at 1:34 PM, ext simon.turvey at nokia.com wrote:
>
>
>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
>>
>
_______________________________________________
>
Qt-qml mailing list
>
Qt-qml at trolltech.com
>
http://lists.trolltech.com/mailman/listinfo/qt-qml
>
_______________________________________________
Qt-qml mailing list
Qt-qml at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100819/b1223e87/attachment.html
More information about the Qt-qml
mailing list