Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Smooth repaint
Qt 6.11 is out! See what's new in the release blog

Smooth repaint

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 566 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shkryab
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved