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 11 Feb 2020, 12:58 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 1 Reply Last reply 11 Feb 2020, 13:13
    0
    • P prex
      11 Feb 2020, 16:30

      @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.

      F Offline
      F Offline
      fcarney
      wrote on 11 Feb 2020, 17:39 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 12 Feb 2020, 09:59
      2
      • P prex
        11 Feb 2020, 12:58

        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 Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 11 Feb 2020, 13:13 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 11 Feb 2020, 16:30
        0
        • J J.Hilk
          11 Feb 2020, 13:13

          @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 11 Feb 2020, 16:30 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.

          F 1 Reply Last reply 11 Feb 2020, 17:39
          0
          • P prex
            11 Feb 2020, 16:30

            @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.

            F Offline
            F Offline
            fcarney
            wrote on 11 Feb 2020, 17:39 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 12 Feb 2020, 09:59
            2
            • F fcarney
              11 Feb 2020, 17:39

              @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 12 Feb 2020, 09:59 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

              4/5

              11 Feb 2020, 17:39

              • Login

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