How can I set center anchors for ScrollView property "contentitem"?



  • I want set rectangle position to application window center
    But there is always only top left anchors. My code is:
    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Window 2.0
    import "qrc:/qml"
    ApplicationWindow {
    visible:true
    id:wp
    ScrollView
    {
    id: wpScroll;
    anchors.fill: parent
    contentItem: Rectangle
    {
    width: 800
    height: 800
    color : "yellow"
    anchors.centerIn: wp.center ///wp=:ApplicationWindow

        Rectangle{
            width: 200;
            height: 200;
            color:"red"
            anchors.bottom:  parent.bottom
        }
    }
    

    }@

    !http://www.7image.ru/pics/1214/469892113.png(Yellow Rect is top left align instead of centered position)!


Log in to reply
 

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