int TocWidget::getIndexDepth(QModelIndex const & index, int depth)
{
++depth;
- return (index.parent() == QModelIndex())? depth : getIndexDepth(index.parent(),depth);
+ return (index.parent() ==
+ QModelIndex())? depth : getIndexDepth(index.parent(),depth);
}
return;
}
- tocTV->selectionModel()->blockSignals(true);
- tocTV->selectionModel()->clear();
- tocTV->scrollTo(index);
- tocTV->selectionModel()->setCurrentIndex(index,
- QItemSelectionModel::ClearAndSelect);
- tocTV->selectionModel()->blockSignals(false);
+ disconnectSelectionModel();
+ tocTV->setCurrentIndex(index);
+ tocTV->scrollTo(index);
+ reconnectSelectionModel();
}
void TocWidget::reconnectSelectionModel()
{
connect(tocTV->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(selectionChanged(const QModelIndex &, const QModelIndex &)));
+ SIGNAL(currentChanged(const QModelIndex &,
+ const QModelIndex &)),
+ this,
+ SLOT(selectionChanged(const QModelIndex &,
+ const QModelIndex &)));
+}
+
+void TocWidget::disconnectSelectionModel()
+{
+ disconnect(tocTV->selectionModel(),
+ SIGNAL(currentChanged(const QModelIndex &,
+ const QModelIndex &)),
+ this,
+ SLOT(selectionChanged(const QModelIndex &,
+ const QModelIndex &)));
}
} // namespace frontend