11#include <QAbstractItemModel>
12#include <QItemSelection>
13#include <QItemSelectionModel>
22 setWindowTitle(
"Selected items in a table model");
29 selectionModel =
table->selectionModel();
36 setCentralWidget(
table);
65 tr(
"Moved from (%1,%2) to (%3,%4)")
67 .arg(current.
row()).arg(current.
column()));
void changeCurrent(const QModelIndex ¤t, const QModelIndex &previous)
void updateSelection(const QItemSelection &selected, const QItemSelection &deselected)
[0]
virtual Q_INVOKABLE bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This signal is emitted whenever the selection changes.
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This signal is emitted whenever the current item changes.
Q_CORE_EXPORT QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
The QMainWindow class provides a main application window.
constexpr int row() const noexcept
Returns the row this model index refers to.
constexpr int column() const noexcept
Returns the column this model index refers to.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
The QTableView class provides a default model/view implementation of a table view.
GLenum GLenum GLsizei void * table
QSqlQueryModel * model
[16]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent