]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocWidget.cpp
Line length, again.
[lyx.git] / src / frontends / qt4 / TocWidget.cpp
index 738e474b157b89b9b6cb7d6605b93c67220684f1..8d8c00e4e1d7fcbc41b7688ac2d84cc245bbdf72 100644 (file)
@@ -315,7 +315,13 @@ void TocWidget::on_typeCO_currentIndexChanged(int index)
 {
        current_type_ = typeCO->itemData(index).toString();
        updateView();
-       gui_view_.setFocus();
+       // In Qt 4.6.x, we can end up here programmatically, when the
+       // model is rebuilt. But the Buffer may not be ready for us to
+       // reset focus, start the cursor, etc. So we check to see if the
+       // combo box has focus. It will, if the user has changed the 
+       // value.
+       if (typeCO->hasFocus())
+               gui_view_.setFocus();
 }
 
 
@@ -404,7 +410,8 @@ void TocWidget::updateView()
        tocTV->setEnabled(false);
        tocTV->setUpdatesEnabled(false);
 
-       QAbstractItemModel * toc_model = gui_view_.tocModels().model(current_type_);
+       QAbstractItemModel * toc_model = 
+                       gui_view_.tocModels().model(current_type_);
        if (tocTV->model() != toc_model) {
                tocTV->setModel(toc_model);
                tocTV->setEditTriggers(QAbstractItemView::NoEditTriggers);