-
Bug
-
Resolution: Done
-
P1: Critical
-
4.6.3
-
None
-
d6cd6c59dae36b2890baae98f0bf94b23e5509da
The selection behaviour is different from the one of 4.5.3. The problem is reproduced with the following example.
- Select multiple rows
- Click inside the table on one row (of the previous selection)
- One would expect that only this row is now selected, but it is not. Sometimes it works on the second or third click
It works always, if you click on the row header instead of inside the table
#include <QtGui> class Widget : public QWidget { Q_OBJECT public: Widget(QWidget *parent = 0); private: QTableView *view1; QStandardItemModel *model; }; Widget::Widget(QWidget *parent) : QWidget(parent) { model = new QStandardItemModel(4, 4); for (int row = 0; row < 4; ++row) { for (int column = 0; column < 4; ++column) { QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column)); model->setItem(row, column, item); } } QHBoxLayout *layout = new QHBoxLayout; view1 = new QTableView; view1->setModel(model); view1->setSelectionBehavior( QAbstractItemView::SelectRows ); view1->setSelectionMode( QAbstractItemView::ExtendedSelection); layout->addWidget(view1); setLayout(layout); } #include "main.moc" int main(int argc, char **argv) { QApplication a(argc, argv); Widget w; w.resize(1024, 200); w.show(); return a.exec(); }