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

QTableView doesn't update scrollbar maximum after model has updated

XMLWordPrintable

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

      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes