In the attachment...

On 16.08.2015 21:40, Dmitry Volosnykh wrote:
You'd better provide your example so that we could run it with qmlscene.

On Sun, Aug 16, 2015 at 9:08 PM, Igor Mironchik <igor.mironc...@gmail.com <mailto:igor.mironc...@gmail.com>> wrote:

    Hi,

    I'm trying to center ListView in a Rectangle.

    I do:

    anchors.centerIn: parent

    But it moves ListView under the real center, so I need to add negative
    verticalCenterOffset.

    I've tried in ListView:

    anchors.verticalCenterOffset: - height / 2.0

    But it doesn't work. If I set verticalCenterOffset without
    calculations,
    i.e. real number then all is ok...

    How can I solve the problem?

    --
    Best Regards,
    Igor Mironchik.

    _______________________________________________
    Interest mailing list
    Interest@qt-project.org <mailto:Interest@qt-project.org>
    http://lists.qt-project.org/mailman/listinfo/interest



--
Best Regards,
Igor Mironchik.

import QtQuick 2.0

Rectangle {
    id: root
    color: "red"

    width: 640
    height: 480

        ListModel {
            id: sampleModel

            Component.onCompleted: {
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/w.png"} )
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/i.png"} )
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/n.png"} )
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/n.png"} )
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/e.png"} )
                sampleModel.append( { "imagePath" : 
"file:/home/igor/Tmp/Center/r.png"} )
            }
        }

        Component {
            id: delegateItem

            Image { source: imagePath }
        }

        ListView {
            id: winner_message
            anchors.centerIn: parent
            anchors.verticalCenterOffset: - height / 2.0
            orientation: ListView.Horizontal
            model: sampleModel
            delegate: delegateItem
            width: childrenRect.width
        }
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to