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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 6.1.0 RC
    • Widgets: Itemviews
    • Ubuntu 21.04, macOS 11.2.2
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated: