// Only one item selected at a time.
tocTV->setSelectionMode(QAbstractItemView::SingleSelection);
+ setFocusProxy(tocTV);
// The toc types combo won't change its model.
typeCO->setModel(gui_view_.tocModels().nameModel());
void TocWidget::on_typeCO_currentIndexChanged(int index)
{
+ if (index == -1)
+ return;
current_type_ = typeCO->itemData(index).toString();
updateView();
if (typeCO->hasFocus())
void TocWidget::updateView()
{
if (!gui_view_.documentBufferView()) {
- enableControls(false);
- typeCO->setEnabled(false);
tocTV->setModel(0);
- tocTV->setEnabled(false);
depthSL->setMaximum(0);
depthSL->setValue(0);
- persistentCB->setEnabled(false);
- sortCB->setEnabled(false);
- depthSL->setEnabled(false);
+ setEnabled(false);
return;
}
+ setEnabled(true);
bool const is_sortable = isSortable();
sortCB->setEnabled(is_sortable);
- depthSL->setEnabled(true);
- typeCO->setEnabled(true);
+ bool focus_ = tocTV->hasFocus();
tocTV->setEnabled(false);
tocTV->setUpdatesEnabled(false);
filterContents();
tocTV->setEnabled(true);
tocTV->setUpdatesEnabled(true);
+ if (focus_)
+ tocTV->setFocus();
}