Qt Designer: Providing context in “dummydata/context” doesn't work



  • A component often uses some context properties (eg parent.width) and hence, when designing this component in Qt Quick Designer, it is useful to somehow provide this context.

    The Qt Quick Designer documentation states that it should be possible to provide this parent context object in the dummydata/context directory.

    However, I don't get it working

    I have a main.qml file containing

    import QtQuick 2.0
    
    Rectangle {
        width:parent.width
        height:parent.height
        color: "green"
    }
    

    and I have a dummydata/context/main.qml file containing

    import QtQuick 1.0
    import QmlDesigner 1.0
    
    DummyContextObject {
        parent: Item {
            width: 640
            height: 300
        }
    }
    

    However, when opening main.qml in Designer, it still gets width=height=0.

    Any ideas how to get this working?



  • To be honest this is a feature we haven't tested for a long time in the Qt Quick 2 context. Can you create an official bug report.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.