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. QML ScrollView binding loop for "contentHeight"

QML ScrollView binding loop for "contentHeight"

Scheduled Pinned Locked Moved Solved QML and Qt Quick
scrollviewlistviewbinding loopqml
5 Posts 3 Posters 1.9k Views
  • 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.
  • P Offline
    P Offline
    prex
    wrote on last edited by
    #1

    Binding loops with scroll views seem to be a popular topic. However, I couldn't solve this issue with the existing posts I found. I'm getting the error:

    QML ScrollView: Binding loop detected for property "contentHeight"
    

    when I'm doing the following in my Qml file:

    ScrollView {
               id: scrollView
               width: 1480
               height: 197
               font.pointSize: 14
               clip: true
               ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
    
               ListView {
                   id: logView
                   x: 20
                   y: 672
                   model: qros.rosLog
                   delegate: logDelegate
                   spacing: 5
               }
           }
    
           Component {
               id: logDelegate
    
               RowLayout {
                   Text {
                       Layout.maximumWidth: 1480
                       color: "#FFFFFF"
                       font.family: "Arial"
                       font.pointSize: 8
                       wrapMode: Text.WordWrap
                       text: modelData
                   }
               }
           }
    

    I don't see where this comes from since this looks like the example.

    J.HilkJ 1 Reply Last reply
    0
    • P prex

      @J-Hilk Unfortunately, this didn't solve it. The GUI works fine until I start scrolling manually in the ScrollView, while new elements are added to the ListView.

      fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #4

      @prex Can you accomplish the same thing without a scrollview? I have found I can do the same with the version 2 of ListViews without scrollviews. YMMV.

      C++ is a perfectly valid school of magic.

      P 1 Reply Last reply
      2
      • P prex

        Binding loops with scroll views seem to be a popular topic. However, I couldn't solve this issue with the existing posts I found. I'm getting the error:

        QML ScrollView: Binding loop detected for property "contentHeight"
        

        when I'm doing the following in my Qml file:

        ScrollView {
                   id: scrollView
                   width: 1480
                   height: 197
                   font.pointSize: 14
                   clip: true
                   ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
        
                   ListView {
                       id: logView
                       x: 20
                       y: 672
                       model: qros.rosLog
                       delegate: logDelegate
                       spacing: 5
                   }
               }
        
               Component {
                   id: logDelegate
        
                   RowLayout {
                       Text {
                           Layout.maximumWidth: 1480
                           color: "#FFFFFF"
                           font.family: "Arial"
                           font.pointSize: 8
                           wrapMode: Text.WordWrap
                           text: modelData
                       }
                   }
               }
        

        I don't see where this comes from since this looks like the example.

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #2

        @prex
        Give your Listview a width/height and the binding loop should go away.

        I assume, without hight/width set, it scales itself to its content and that trickers a contentHeight change of the scrollView


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        P 1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @prex
          Give your Listview a width/height and the binding loop should go away.

          I assume, without hight/width set, it scales itself to its content and that trickers a contentHeight change of the scrollView

          P Offline
          P Offline
          prex
          wrote on last edited by
          #3

          @J-Hilk Unfortunately, this didn't solve it. The GUI works fine until I start scrolling manually in the ScrollView, while new elements are added to the ListView.

          fcarneyF 1 Reply Last reply
          0
          • P prex

            @J-Hilk Unfortunately, this didn't solve it. The GUI works fine until I start scrolling manually in the ScrollView, while new elements are added to the ListView.

            fcarneyF Offline
            fcarneyF Offline
            fcarney
            wrote on last edited by
            #4

            @prex Can you accomplish the same thing without a scrollview? I have found I can do the same with the version 2 of ListViews without scrollviews. YMMV.

            C++ is a perfectly valid school of magic.

            P 1 Reply Last reply
            2
            • fcarneyF fcarney

              @prex Can you accomplish the same thing without a scrollview? I have found I can do the same with the version 2 of ListViews without scrollviews. YMMV.

              P Offline
              P Offline
              prex
              wrote on last edited by
              #5

              @fcarney Easy as that. This works perfectly fine with just a ListView. I added a ScrollBar to it and I have the same without any binding loops. Thanks!

              1 Reply Last reply
              2

              • Login

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