[Development] Window{} API for QML

Alan Alpert alan.alpert at nokia.com
Mon Nov 21 08:26:44 CET 2011


On Tue, 15 Nov 2011 19:24:50 ext Alan Alpert wrote:
> If we mostly agree, then that's a good starting point. I'll start
> prototyping a Window{} with the following minimal API in a QtQuick.Window
> import (unless someone has a better idea for the name, as this import
> could also contain the exposed Screen stuff that is highly related).
> 
> Window{ //Not inheriting QQuickItem, creates a new top level window.
>     property int x
>     property int y
>     property int width
>     property int height
>     property bool visible
>     property Orientation requestedOrientation // { Portrait, Landscape, Š }
> }

http://codereview.qt-project.org/#change,9258 in qtdeclarative and
http://codereview.qt-project.org/#change,9254 in qtbase
contains said prototype.

It takes the approach of exposing QQuickCanvas, a QWindow subclass, to QML. 
This allows the window properties to be exposed directly from QWindow, which 
has advantages and disadvantages. There is the advantage that the properties 
are used directly and there's no indirection layer in the way increasing 
maintenance and decreasing performance. But it has the downside of making 
QWindow public QML API which means even more care needs to be taken when 
altering it, as it needs to make sense in QML and C++ - not to mention follow 
the QML version compatibility rules on top of the C++ ones.

-- 
Alan Alpert
Senior Engineer
Nokia, Qt Development Frameworks



More information about the Development mailing list