SelectionModelSynchronizer::SelectionModelSynchronizer(QAbstractItemModel *parent)
: QObject(parent),
_model(parent),
- _selectionModel(parent),
- _changeCurrentEnabled(true),
- _changeSelectionEnabled(true)
+ _selectionModel(parent)
{
connect(&_selectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
this, SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));
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();