Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QListWidget - Auto Scroll

QListWidget - Auto Scroll

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 19.1k 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.
  • A Offline
    A Offline
    awood969
    wrote on last edited by
    #1

    Hi all!

    I am using a QListWidget to display various messages in a lightweight server application. However one tiny cosmetic problem is really irritating me,

    As items are being added to the list the vertical scrollbar will not automatically scroll down to always show the latest message at the bottom of the QListWidget. There appears to be an 'autoscroll' option in the design properties of the QListWidget but I'm yet to understand what this does.

    Could anybody help please??

    Much Love
    Andrew

    I'm only asking as I'm stupid :-)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Did you try to call "QAbstractItemView::scrollToBottom()":http://doc.qt.nokia.com/4.7/qabstractitemview.html#scrollToBottom after you have added an item? (the function is available in all subclasses, including QListWidget).

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        awood969
        wrote on last edited by
        #3

        Yes my issue is more how can I do this using connect() signals and slots as nearly all methods and several classes are pumping data into this QListWidget so it would be much easier to simply signal the system to do it.

        Thanks
        Andrew

        I'm only asking as I'm stupid :-)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          You can try this (I did not try it myself):

          @
          connect(
          listView->model(),
          SIGNAL(rowsInserted ( const QModelIndex &, int, int ) ),
          listView,
          SLOT(scrollToBottom ())
          );
          @

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • A Offline
            A Offline
            awood969
            wrote on last edited by
            #5

            That worked perfectly first time, your a star. Thank You :-D

            I'm only asking as I'm stupid :-)

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Oh wow... I'd rather believe I did too much (sometimes fance, sometimes not so fancy) stuff with list views in the last years :-)

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • E Offline
                E Offline
                e.n.shirokov
                wrote on last edited by
                #7

                When you frequently add lines to the model, the widget starts to slow down. You can make setUniformItemSizes(), but I want the elements to be of different heights.
                There is a 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