#include <QtGui/QApplication>
#include <QtGui/QTableWidget>
#include <QtGui/QAbstractItemView>
int main(int argc, char *argv[])
{
w.selectRow(1);
w.selectRow(3);
w.selectRow(5);
selectionModel->clearSelection();
w.show(); // ideally, upon show rows 2,4 and 6 should appear selected.
// now, all three rows are selected.
w.resize(350,400);
return a.exec();
}
#include <QtGui/QApplication>
#include <QtGui/QTableWidget>
#include <QtGui/QAbstractItemView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableWidget w(10,3);
QItemSelectionModel *selectionModel = w.selectionModel();
w.selectRow(1);
QItemSelection itemSelection = selectionModel->selection();
w.selectRow(3);
itemSelection.merge(selectionModel->selection(), QItemSelectionModel::Select);
w.selectRow(5);
itemSelection.merge(selectionModel->selection(), QItemSelectionModel::Select);
selectionModel->clearSelection();
selectionModel->select(itemSelection,QItemSelectionModel::Select);
w.show(); // ideally, upon show rows 2,4 and 6 should appear selected.
// now, all three rows are selected.
w.resize(350,400);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks