Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135328

QTableView doesn't update scrollbar maximum after model has updated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • 6.8.2
    • Widgets: Itemviews
    • None
    • macOS, Windows

    Description

      QTableView doesn't update the maximum of vertical scrollbar after items has been inserted into the model. This behavior makes it not possible to scrollTo new indexes.

      view.show();
      for (int i = 0; i < 100; ++i)
          model.invisibleRootItem()->appendRow(new QStandardItem(QString::number(i)));
      view.setModel(&model);
      qDebug() << view.verticalScrollBar()->maximum();
      for (int i = 0; i < 100; ++i)
          model.invisibleRootItem()->appendRow(new QStandardItem(QString::number(i)));
      qDebug() << view.verticalScrollBar()->maximum();
      view.scrollToBottom();
      qDebug() << view.verticalScrollBar()->maximum();
      

       The output of minimal example is

      95
      95
      195
      

      The second line indicates that the maximum of vertical scrollbar is not updated.

      Attachments

        1. main-1.cpp
          0.7 kB
          Xun Yuan
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            yuanxun Xun Yuan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes