]> git.lyx.org Git - features.git/commitdiff
Slight rearrangement
authorRichard Kimberly Heck <rikiheck@lyx.org>
Wed, 16 Aug 2023 22:38:19 +0000 (18:38 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Wed, 16 Aug 2023 22:38:19 +0000 (18:38 -0400)
src/frontends/qt/LayoutBox.cpp

index ed80332a4d951491d4fe0d8d229f96899bfcebef..a4ad9ba2bfba5e882b3bad4fdbe3064f0680a4d1 100644 (file)
@@ -618,19 +618,19 @@ void LayoutBox::updateContents(bool reset)
 
 void LayoutBox::selected(int index)
 {
-       // get selection
-       QModelIndex mindex = d->filterModel_->mapToSource(
-               d->filterModel_->index(index, 1));
-       docstring layoutName = qstring_to_ucs4(
-               d->model_->itemFromIndex(mindex)->text());
        d->owner_.setFocus();
-
        if (!d->text_class_) {
                updateContents(false);
                d->resetFilter();
                return;
        }
 
+       // get selection
+       QModelIndex mindex = d->filterModel_->mapToSource(
+               d->filterModel_->index(index, 1));
+       docstring const layoutName = qstring_to_ucs4(
+               d->model_->itemFromIndex(mindex)->text());
+
        // find corresponding text class
        if (d->text_class_->hasLayout(layoutName)) {
                FuncRequest const func(LFUN_LAYOUT, layoutName, FuncRequest::TOOLBAR);
@@ -639,7 +639,7 @@ void LayoutBox::selected(int index)
                d->resetFilter();
                return;
        }
-       LYXERR0("ERROR (layoutSelected): layout " << layoutName << " not found!");
+       LYXERR0("ERROR (LayoutBox::Selected): layout " << layoutName << " not found!");
 }