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

QTableWidget : signal order not the same between mouse clics and key strokes

    XMLWordPrintable

Details

    Description

      The signal currentCellChanged/itemSelectionChanged aren't trigger in same order by mouse click and key stroke.

      Test code.

      #include <QVBoxLayout>
      #include <QMainWindow>
      #include <QItemDelegate>
      #include <QObject>
      #include <QEvent>
      #include <QWidget>
      #include <QKeyEvent>
      #include <QMetaObject>
      #include <QStyleOptionViewItem>
      #include <QModelIndex>
      #include <QAbstractItemDelegate>
      #include <QMap>
      #include <QTableWidget>
      #include <QTableWidgetItem>
      #include <QApplication>
      #include <QMessageBox>

      static int ROWS = 10;
      static int COLS = 2;
      class Table : public QTableWidget
      {
      Q_OBJECT
      public:
      Table(QWidget *parent = 0)
      : QTableWidget(ROWS, COLS, parent)
      {
      for (int i=0; i<rowCount(); ++i) {
      for (int j=0; j<columnCount(); ++j)

      { setItem(i, j, new QTableWidgetItem); }

      }

      connect(this, SIGNAL(currentCellChanged(int, int, int, int)),
      this, SLOT(on_currentCellChanged(int, int, int, int)));

      connect(this, SIGNAL(itemSelectionChanged()),
      this, SLOT(on_itemSelectionChanged()));
      }

      public slots:
      void on_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn)

      { QMessageBox::information(this, "Test", "currentCellChanged"); }

      void on_itemSelectionChanged()

      { QMessageBox::information(this, "Test", "itemSelectionChanged"); }

      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      Table w;
      w.show();
      return a.exec();
      }

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            ebaak Ed Baak (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes