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. Change position of a ScrollView
Qt 6.11 is out! See what's new in the release blog

Change position of a ScrollView

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 4 Posters 6.0k 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.
  • D Offline
    D Offline
    DavidM29
    wrote on last edited by
    #1

    Hello,

    I have a kind of pop up window with a scroll view that I change the visibility of to hide or shows it. I want to change the position of the scroll when I change the visibity. The thing is that I don't know how to set the scrollview position automatically.

    Can anybody help me with this ?

    Thank you in advance

    ODБOïO 1 Reply Last reply
    0
    • D DavidM29

      Hello,

      I have a kind of pop up window with a scroll view that I change the visibility of to hide or shows it. I want to change the position of the scroll when I change the visibity. The thing is that I don't know how to set the scrollview position automatically.

      Can anybody help me with this ?

      Thank you in advance

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

      @DavidM29 Hi,
      I think you are looking for properties : flickableItem.contentY and flickableItem.contentX

      see also this page : https://stackoverflow.com/questions/30359262/how-to-scroll-qml-scrollview-to-center

      1 Reply Last reply
      1
      • D Offline
        D Offline
        DavidM29
        wrote on last edited by
        #3

        @LeLev
        Thank you it is what I needed !

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dokif
          wrote on last edited by
          #4

          Hi,
          That solution works only for Qt Quick controls 1. Is there any solution for Quick Controls 2?

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Eeli K
            wrote on last edited by
            #5

            I tried to find a solution for Controls 2 and found only this thread, so I reply here after finding the solution by the hard way myself.

            In Controls 2 ScrollView has run time contentItem which is Flickable (undocumented feature). This Flickable has contentY and contentX properties, see the official docs how to use them. For example, I made a function in a ScrollView which has TextArea with id 'edit':

            function scrollToBottom() {
                contentItem.contentY = edit.height - contentItem.height
            }
            

            This seems to work.

            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