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

QTableWidget Row Remove/Insert bug

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • 4.6.0
    • 4.3.1
    • Widgets: Itemviews
    • None

    Description

      The following program reproduces a bug in QTableWidget

      To reproduce:

      start app
      click "Hide 2nd Row"
      click "Remove and Insert 1st Row"

      notice that the table displays a vertical scrollbar now
      scroll to the bottom
      notice that the 1st row is repeated down there

      #include <QtGui>

      class TableWidget : public QTableWidget
      {
      Q_OBJECT
      public:
      TableWidget(QWidget *parent)
      : QTableWidget(parent)

      { setRowCount(2); setColumnCount(2); }

      public slots:
      void hide2ndRow()

      { setRowHidden(1, true); }

      void removeAndInsert1stRow()

      { removeRow(0); insertRow(0); }

      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication app(argc, argv);
      QWidget widget;
      new QVBoxLayout(&widget);
      QPushButton *pb1 = new QPushButton("Hide 2nd Row", &widget);
      widget.layout()->addWidget(pb1);
      QPushButton *pb2 = new QPushButton("Remove and Insert 1st Row", &widget);
      widget.layout()->addWidget(pb2);
      TableWidget *table = new TableWidget(&widget);
      widget.layout()->addWidget(table);
      table->connect(pb1, SIGNAL(clicked()), SLOT(hide2ndRow()));
      table->connect(pb2, SIGNAL(clicked()), SLOT(removeAndInsert1stRow()));

      widget.show();

      return app.exec();
      }

      Attachments

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

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            rve Anders Bakken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes