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();
}
QString current_text = typeCO->currentText();
lyxerr << "current_text " << fromqstr(current_text) << endl;
typeCO->blockSignals(true);
+ typeCO->clear();
int current_type = -1;
for (size_t i = 0; i != type_names.size(); ++i) {
QString item = toqstr(type_names[i]);
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