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. Updating Scrollbar QTableView when model shrink
Forum Updated to NodeBB v4.3 + New Features

Updating Scrollbar QTableView when model shrink

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.0k 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.
  • M Offline
    M Offline
    Misty River
    wrote on 3 Sept 2015, 16:30 last edited by
    #1

    Hello,

    I have a model that dynamically shrinks and grows depending on user inputs and it is display in a tableview... the problem I'm having is that the scrollbars are never updated... they are set to the size of the data when I call setModel().. but when the model shrinks I can still scroll past the new smaller data... I've tried calling reset() and update() on the tableview but it has no effect on the scrollbar... How can I update the scrollbar so that it doesn't go past the size of the data??

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Sept 2015, 20:27 last edited by
      #2

      Hi,

      Sounds like a glitch, what version of Qt are you using ? On which platform ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 3 Sept 2015, 22:26
      0
      • S SGaist
        3 Sept 2015, 20:27

        Hi,

        Sounds like a glitch, what version of Qt are you using ? On which platform ?

        M Offline
        M Offline
        Misty River
        wrote on 3 Sept 2015, 22:26 last edited by
        #3

        @SGaist I'm using the latest version of Qt on windows 10

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on 3 Sept 2015, 23:15 last edited by alex_malyu 9 Mar 2015, 23:16
          #4

          If you are using custom model, it mostly likely a sign that model does not call appropriate required functions which are used for notification about data changes.

          M 2 Replies Last reply 4 Sept 2015, 00:06
          0
          • A alex_malyu
            3 Sept 2015, 23:15

            If you are using custom model, it mostly likely a sign that model does not call appropriate required functions which are used for notification about data changes.

            M Offline
            M Offline
            Misty River
            wrote on 4 Sept 2015, 00:06 last edited by
            #5

            @alex_malyu Yes, it is a custom model... and you are right I do not call any function when I change the data... I simply have a setter function that sets the model data... how should I go about changing the data??

            1 Reply Last reply
            0
            • A alex_malyu
              3 Sept 2015, 23:15

              If you are using custom model, it mostly likely a sign that model does not call appropriate required functions which are used for notification about data changes.

              M Offline
              M Offline
              Misty River
              wrote on 4 Sept 2015, 00:08 last edited by
              #6

              @alex_malyu The custom model derives from QAbstractTableModel btw...

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alex_malyu
                wrote on 4 Sept 2015, 00:10 last edited by alex_malyu 9 Apr 2015, 00:12
                #7

                look at:
                https://doc.qt.io/archives/4.6/model-view-creating-models.html
                and
                http://doc.qt.io/qt-5/qabstractitemmodel.html

                functions of interest typically start with begin...., end...
                like:
                void beginInsertRows(const QModelIndex & parent, int first, int last)
                void beginRemoveRows(const QModelIndex & parent, int first, int last)
                void beginResetModel()
                ....

                1 Reply Last reply
                0

                3/7

                3 Sept 2015, 22:26

                • Login

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