Smooth repaint



  • Hi!
    I have elemens hierarchy like this:

    RootItem.qml
    @
    import QtQuick 2.0

    Flickable {
        id: flickable
        anchors.fill: parent
        contentHeight: content.height
        contentWidth: content.width
    
        visibleArea.onYPositionChanged:  item2.internalY = flickable.mapToItem( item2, 0, 20 ).y
    
        Item {
            id: content
            height:  800
            width: 300
            Column {
                anchors.fill: parent
                Level2 {
                    id: item2
                    anchors { left: parent.left; right: parent.right }
                }
            }
        }
    }
    

    @

    Level2.qml
    @
    import QtQuick 2.0

    Rectangle {
    height: 800

    property int internalY: 0
    
    Level3 {
        anchors.fill: parent
        internalY: parent.internalY + 5
    }
    

    }
    @

    Level3.qml
    @
    import QtQuick 2.0

    Item {
    property int internalY: 0

    Rectangle {
        id: internal
        height: 20
        width: 20
        anchors { right: parent.right }
    
        y: internalY + 5
    }
    

    }
    @

    Objective - positioning "internal" element relative to "flickable". In the example above all works fine. But in real project (with a large number of elements) on scrolling the "internal" element doesn't move smoothly. I think this is because the values ​​of properties are set through the event queue. If change all property ("internalY") to alias it is solve the problem. But moving all logic in root element - it's bad idea. Is there another solution?


Log in to reply
 

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