11#include <QApplication>
12#include <QItemSelection>
13#include <QItemSelectionModel>
18int main(
int argc,
char *argv[])
47 toggleSelection.select(topLeft, bottomRight);
58 columnSelection.select(topLeft, bottomRight);
60 selectionModel->
select(columnSelection,
68 rowSelection.select(topLeft, bottomRight);
70 selectionModel->
select(rowSelection,
74 table->setWindowTitle(
"Selected items in a table model");
76 table->resize(460, 280);
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the data in row and column with parent.
The QApplication class manages the GUI application's control flow and main settings.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
The QTableView class provides a default model/view implementation of a table view.
GLenum GLenum GLsizei void * table
QSqlQueryModel * model
[16]
QItemSelection * selection
[0]
QApplication app(argc, argv)
[0]