commit ced6c591fbe277ff01ee82367bbdf82d5afda5a4
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Feb 12 14:33:27 2023 +0100
Silence warning when unappropriate
---
src/frontends/qt/CategorizedCombo.cpp | 5 +++--
src/frontends/qt/CategorizedCombo.h | 2 +-
src/frontends/qt/GuiDocument.cpp | 15 +++++++++------
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/frontends/qt/CategorizedCombo.cpp
b/src/frontends/qt/CategorizedCombo.cpp
index 9053228..81cf89a 100644
--- a/src/frontends/qt/CategorizedCombo.cpp
+++ b/src/frontends/qt/CategorizedCombo.cpp
@@ -449,7 +449,7 @@ void CategorizedCombo::setIconSize(QSize size)
}
-bool CategorizedCombo::set(QString const & item)
+bool CategorizedCombo::set(QString const & item, bool const report_missing)
{
d->resetFilter();
@@ -464,7 +464,8 @@ bool CategorizedCombo::set(QString const & item)
QList<QStandardItem *> r = d->model_->findItems(item, Qt::MatchExactly,
1);
if (r.empty()) {
- LYXERR0("Trying to select non existent layout type " << item);
+ if (report_missing)
+ LYXERR0("Trying to select non existent layout type " <<
item);
return false;
}
diff --git a/src/frontends/qt/CategorizedCombo.h
b/src/frontends/qt/CategorizedCombo.h
index 10d730b..51bdb4f 100644
--- a/src/frontends/qt/CategorizedCombo.h
+++ b/src/frontends/qt/CategorizedCombo.h
@@ -38,7 +38,7 @@ public:
~CategorizedCombo();
/// select an item in the combobox. Returns false if item does not exist
- bool set(QString const & cc);
+ bool set(QString const & cc, bool const report_missing = true);
/// Reset the combobox.
void reset();
/// Reset the combobox filter.
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 60f9f84..6e8019d 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -2474,9 +2474,12 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
outputModule->defaultFormatCO->setCurrentIndex(index);
// try to restore fonts which were selected two toggles ago
- fontModule->fontsRomanCO->set(fontModule->font_roman);
- fontModule->fontsSansCO->set(fontModule->font_sans);
- fontModule->fontsTypewriterCO->set(fontModule->font_typewriter);
+ if (!fontModule->font_roman.isEmpty())
+ fontModule->fontsRomanCO->set(fontModule->font_roman);
+ if (!fontModule->font_sans.isEmpty())
+ fontModule->fontsSansCO->set(fontModule->font_sans);
+ if (!fontModule->font_typewriter.isEmpty())
+ fontModule->fontsTypewriterCO->set(fontModule->font_typewriter);
index = fontModule->fontsMathCO->findData(fontModule->font_math);
if (index != -1)
fontModule->fontsMathCO->setCurrentIndex(index);
@@ -4399,7 +4402,7 @@ void GuiDocument::paramsToDialog()
bp_.fontsize);
QString font = toqstr(bp_.fontsRoman());
- bool foundfont = fontModule->fontsRomanCO->set(font);
+ bool foundfont = fontModule->fontsRomanCO->set(font, false);
if (!foundfont) {
fontModule->fontsRomanCO->addItemSort(font, font + qt_(" (not
installed)"),
qt_("Uninstalled used
fonts"),
@@ -4410,7 +4413,7 @@ void GuiDocument::paramsToDialog()
fontModule->font_roman = toqstr(bp_.fonts_roman[!bp_.useNonTeXFonts]);
font = toqstr(bp_.fontsSans());
- foundfont = fontModule->fontsSansCO->set(font);
+ foundfont = fontModule->fontsSansCO->set(font, false);
if (!foundfont ) {
fontModule->fontsSansCO->addItemSort(font, font + qt_(" (not
installed)"),
qt_("Uninstalled used
fonts"),
@@ -4421,7 +4424,7 @@ void GuiDocument::paramsToDialog()
fontModule->font_sans = toqstr(bp_.fonts_sans[!bp_.useNonTeXFonts]);
font = toqstr(bp_.fontsTypewriter());
- foundfont = fontModule->fontsTypewriterCO->set(font);
+ foundfont = fontModule->fontsTypewriterCO->set(font, false);
if (!foundfont) {
fontModule->fontsTypewriterCO->addItemSort(font, font + qt_("
(not installed)"),
qt_("Uninstalled
used fonts"),
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs