_model(parent),
_selectionModel(parent)
{
- connect(&_selectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));
- connect(&_selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
- this, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
+ connect(&_selectionModel, &QItemSelectionModel::currentChanged,
+ this, &SelectionModelSynchronizer::currentChanged);
+ connect(&_selectionModel, &QItemSelectionModel::selectionChanged,
+ this, &SelectionModelSynchronizer::selectionChanged);
}
return;
}
- connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- this, SLOT(syncedCurrentChanged(QModelIndex, QModelIndex)));
- connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
- this, SLOT(syncedSelectionChanged(QItemSelection, QItemSelection)));
+ connect(selectionModel, &QItemSelectionModel::currentChanged,
+ this, &SelectionModelSynchronizer::syncedCurrentChanged);
+ connect(selectionModel, &QItemSelectionModel::selectionChanged,
+ this, &SelectionModelSynchronizer::syncedSelectionChanged);
- connect(selectionModel, SIGNAL(destroyed(QObject *)), this, SLOT(selectionModelDestroyed(QObject *)));
+ connect(selectionModel, &QObject::destroyed, this, &SelectionModelSynchronizer::selectionModelDestroyed);
_selectionModels << selectionModel;
}
void SelectionModelSynchronizer::selectionModelDestroyed(QObject *object)
{
- QItemSelectionModel *model = static_cast<QItemSelectionModel *>(object);
+ auto *model = static_cast<QItemSelectionModel *>(object);
QSet<QItemSelectionModel *>::iterator iter = _selectionModels.begin();
while (iter != _selectionModels.end()) {
if (*iter == model) {
if (!_changeCurrentEnabled)
return;
- QItemSelectionModel *selectionModel = qobject_cast<QItemSelectionModel *>(sender());
+ auto *selectionModel = qobject_cast<QItemSelectionModel *>(sender());
Q_ASSERT(selectionModel);
QModelIndex newSourceCurrent = mapToSource(current, selectionModel);
if (newSourceCurrent.isValid() && newSourceCurrent != currentIndex())
if (!_changeSelectionEnabled)
return;
- QItemSelectionModel *selectionModel = qobject_cast<QItemSelectionModel *>(sender());
+ auto *selectionModel = qobject_cast<QItemSelectionModel *>(sender());
Q_ASSERT(selectionModel);
QItemSelection mappedSelection = selectionModel->selection();