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. Scrolling a ColumnLayout
Forum Updated to NodeBB v4.3 + New Features

Scrolling a ColumnLayout

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 489 Views 2 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.
  • LorenDBL Offline
    LorenDBL Offline
    LorenDB
    wrote on last edited by
    #1

    In my code, I have something like the following:

    ScrollView {
        clip: true
        ColumnLayout {
            spacing: 10
            anchors.fill: parent
            Label {
                text: "..."
            } // there are 13 of these in my case
        }
    }
    

    Unfortunately, this does not work as expected. Instead of providing a scrollable view that will allow me to view all of the labels when the window isn't very tall, the labels just run off the screen and won't scroll at all.

    To make things more complex, I've got the ScrollView in a ColumnLayout. I don't know if this would have any effect, though.

    How should I be programming this so that it will scroll?

    ODБOïO 1 Reply Last reply
    0
    • LorenDBL LorenDB

      In my code, I have something like the following:

      ScrollView {
          clip: true
          ColumnLayout {
              spacing: 10
              anchors.fill: parent
              Label {
                  text: "..."
              } // there are 13 of these in my case
          }
      }
      

      Unfortunately, this does not work as expected. Instead of providing a scrollable view that will allow me to view all of the labels when the window isn't very tall, the labels just run off the screen and won't scroll at all.

      To make things more complex, I've got the ScrollView in a ColumnLayout. I don't know if this would have any effect, though.

      How should I be programming this so that it will scroll?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      hi
      [EDIT] Did you give a size (height/width) to your ScrollView ?

      1 Reply Last reply
      0
      • LorenDBL Offline
        LorenDBL Offline
        LorenDB
        wrote on last edited by LorenDB
        #3

        @LeLev setting Layout.preferrredWidth and Layout.preferrredHeight on the ScrollView (remember it's in a ColumnLayout) worked, but I'd really like if I could have the width and height automatically fill the available space.

        Edit: Oddly, enough, setting Layout.fillWidth and Layout.fillHeight to true fixed the problem.

        ODБOïO 1 Reply Last reply
        0
        • LorenDBL LorenDB

          @LeLev setting Layout.preferrredWidth and Layout.preferrredHeight on the ScrollView (remember it's in a ColumnLayout) worked, but I'd really like if I could have the width and height automatically fill the available space.

          Edit: Oddly, enough, setting Layout.fillWidth and Layout.fillHeight to true fixed the problem.

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @LorenDB
          do you mean
          https://doc.qt.io/qt-5/qml-qtquick-layouts-layout.html#fillHeight-attached-prop
          https://doc.qt.io/qt-5/qml-qtquick-layouts-layout.html#fillWidth-attached-prop

          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