[Development] AplicationWindow, QQuickWindow, contentRotation and setting width and height of contentItem

Tomasz Olszak olszak.tomasz at gmail.com
Fri Aug 2 08:22:58 CEST 2013


>
> Like Flickable, you aren't supposed to control the contentItem of
> Window. It's only exposed because it unfortunately cannot be fully
> hidden as an implementation detail (at least not without breaking
> certain edge cases). So it's deliberate that you aren't able to
> override this like a binding.
>
> I understand Flickable case but could you please point out Window edge
cases?

What's the problem with creating your own item instead of trying to
> reuse the contentItem? Something like:
> /* ApplicationWindow.qml */
> Window {
>     default property alias myData: myContentItem.data
>     Item {
>         id: myContentItem
>         //All rotation logic goes here
>     }
> }
>

Problem is with Items like ModalPopupBehavior from QtQuick.Controls:

Item {
    ...
    property Item root: findRoot()
    function findRoot() {
        var p = parent;
        while(p.parent != undefined)
            p = p.parent;

        return p;
    }

   ...
    anchors.fill: parent

    states: State {
        name: "active"
        when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity >
0
        ParentChange { target: popupBehavior; parent: root }
    }
}

If I add my own Item then ModalPopupBehavior will not be rotated because
its parent will be contentItem. Of course I can change condition in
findRoot function to:
        while(p.parent.parent != undefined)
but I think that most app developers won't do this in their own modals.



-- 
regards Tomasz Olszak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130802/f29da1be/attachment.html>


More information about the Development mailing list