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

Setting a row span on a QTableView causes cell editing to break

    XMLWordPrintable

Details

    • Qt 5: a18e3a3ceff970250498b38ec85ae43c67b7993f

    Description

      Steps to reproduce using the app below:

      1. Select any of these cells: (2, 0), (3, 0), (3, 1)
      2. Navigate to cell containing the span (1, 1) with either the directional keys or tab/backtab (using the mouse does not reproduce the bug).
      3. Edit the cell's contents - they won't change after confirming the changes.

      Seems to be caused by a cell below/to the side of the cell at (1, 1) being selected before editing it.

      #include <QApplication>
      #include <QHeaderView>
      #include <QStandardItemModel>
      #include <QTableView>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          
          QStandardItemModel model(4, 2);
          QTableView tableView;
          tableView.setModel(&model);
          
          tableView.horizontalHeader()->setStretchLastSection(true);
          
          for (int row = 0; row < 4; ++row) {
              for (int column = 0; column < 2; ++column) {
                  QModelIndex index = model.index(row, column, QModelIndex());
                  model.setData(index, QVariant(QString("%1,%2").arg(row).arg(column)));
              }
          }
          
          tableView.setSpan(1, 1, 2, 1); // Problem.
          
          tableView.show();
          return app.exec();
      }

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            mitch_curtis Mitch Curtis
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes