[LyX/master] Make code a bit easier to read

Richard Kimberly Heck rikiheck at lyx.org
Wed Aug 16 21:36:27 UTC 2023


commit a6b83b7444e2ad1060dd2cd01d54570d41120804
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Wed Aug 16 18:52:04 2023 -0400

    Make code a bit easier to read
---
 src/frontends/qt/LayoutBox.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/LayoutBox.cpp b/src/frontends/qt/LayoutBox.cpp
index a4ad9ba..1cc6476 100644
--- a/src/frontends/qt/LayoutBox.cpp
+++ b/src/frontends/qt/LayoutBox.cpp
@@ -626,10 +626,11 @@ void LayoutBox::selected(int index)
 	}
 
 	// get selection
-	QModelIndex mindex = d->filterModel_->mapToSource(
-		d->filterModel_->index(index, 1));
-	docstring const layoutName = qstring_to_ucs4(
-		d->model_->itemFromIndex(mindex)->text());
+	// get the index of the untranslated layout name (which is in column 1)
+	QModelIndex const lindex = d->filterModel_->index(index, 1);
+	QModelIndex const mindex = d->filterModel_->mapToSource(lindex);
+	QString const qlayout = d->model_->itemFromIndex(mindex)->text();
+	docstring const layoutName = qstring_to_ucs4(qlayout);
 
 	// find corresponding text class
 	if (d->text_class_->hasLayout(layoutName)) {


More information about the lyx-cvs mailing list