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

QTableView hangs when row count >= 100`000`000

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 6.1.0 RC
    • Fix Version/s: None
    • Component/s: Widgets: Itemviews
    • Labels:
    • Environment:
      Ubuntu 21.04, macOS 11.2.2
    • Platform/s:
      Linux/X11, macOS

      Description

      #include <QApplication>
      #include <QTableView>
      
      enum
      {
          COLUMN_COUNT = 1,
          ROW_COUNT    = 100000000
      };
      
      struct TestModel : QAbstractItemModel
      {
          int columnCount( const QModelIndex& in_parent ) const override { return in_parent.isValid() ? 0 : COLUMN_COUNT; }
          int rowCount( const QModelIndex& in_parent ) const override { return in_parent.isValid() ? 0 : ROW_COUNT; }
      
          QModelIndex index( int in_row, int in_column, const QModelIndex& in_parent ) const override
          {
              if( in_parent.isValid() )
                  return {};
      
              return createIndex( in_row, in_column );
          }
      
          QModelIndex parent( const QModelIndex& /*in_child*/ ) const override { return {}; }
      
          QVariant data( const QModelIndex& in_index, int in_role ) const override
          {
              switch( in_role )
              {
                  case Qt::DisplayRole: return QString( "%1:%2").arg( in_index.row() ).arg( in_index.column() );
      
                  default:;
              }
      
              return {};
          }
      };
      
      int main( int argc, char *argv[] )
      {
          QApplication a( argc, argv );
      
          QTableView t;
          t.setModel( new TestModel );
          t.show();
      
          return a.exec();
      }
      
      

      "Jira could not attach the file as there was a missing token. Please try attaching the file again.". So I posted example code here.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            igornikitin Igor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes