Silence warning when unappropriate

This commit is contained in:
Juergen Spitzmueller 2023-02-12 14:33:27 +01:00
parent c0bca65635
commit ced6c591fb
3 changed files with 13 additions and 9 deletions

View File

@ -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(); d->resetFilter();
@ -464,6 +464,7 @@ bool CategorizedCombo::set(QString const & item)
QList<QStandardItem *> r = d->model_->findItems(item, Qt::MatchExactly, 1); QList<QStandardItem *> r = d->model_->findItems(item, Qt::MatchExactly, 1);
if (r.empty()) { if (r.empty()) {
if (report_missing)
LYXERR0("Trying to select non existent layout type " << item); LYXERR0("Trying to select non existent layout type " << item);
return false; return false;
} }

View File

@ -38,7 +38,7 @@ public:
~CategorizedCombo(); ~CategorizedCombo();
/// select an item in the combobox. Returns false if item does not exist /// 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. /// Reset the combobox.
void reset(); void reset();
/// Reset the combobox filter. /// Reset the combobox filter.

View File

@ -2474,8 +2474,11 @@ void GuiDocument::osFontsChanged(bool nontexfonts)
outputModule->defaultFormatCO->setCurrentIndex(index); outputModule->defaultFormatCO->setCurrentIndex(index);
// try to restore fonts which were selected two toggles ago // try to restore fonts which were selected two toggles ago
if (!fontModule->font_roman.isEmpty())
fontModule->fontsRomanCO->set(fontModule->font_roman); fontModule->fontsRomanCO->set(fontModule->font_roman);
if (!fontModule->font_sans.isEmpty())
fontModule->fontsSansCO->set(fontModule->font_sans); fontModule->fontsSansCO->set(fontModule->font_sans);
if (!fontModule->font_typewriter.isEmpty())
fontModule->fontsTypewriterCO->set(fontModule->font_typewriter); fontModule->fontsTypewriterCO->set(fontModule->font_typewriter);
index = fontModule->fontsMathCO->findData(fontModule->font_math); index = fontModule->fontsMathCO->findData(fontModule->font_math);
if (index != -1) if (index != -1)
@ -4399,7 +4402,7 @@ void GuiDocument::paramsToDialog()
bp_.fontsize); bp_.fontsize);
QString font = toqstr(bp_.fontsRoman()); QString font = toqstr(bp_.fontsRoman());
bool foundfont = fontModule->fontsRomanCO->set(font); bool foundfont = fontModule->fontsRomanCO->set(font, false);
if (!foundfont) { if (!foundfont) {
fontModule->fontsRomanCO->addItemSort(font, font + qt_(" (not installed)"), fontModule->fontsRomanCO->addItemSort(font, font + qt_(" (not installed)"),
qt_("Uninstalled used fonts"), qt_("Uninstalled used fonts"),
@ -4410,7 +4413,7 @@ void GuiDocument::paramsToDialog()
fontModule->font_roman = toqstr(bp_.fonts_roman[!bp_.useNonTeXFonts]); fontModule->font_roman = toqstr(bp_.fonts_roman[!bp_.useNonTeXFonts]);
font = toqstr(bp_.fontsSans()); font = toqstr(bp_.fontsSans());
foundfont = fontModule->fontsSansCO->set(font); foundfont = fontModule->fontsSansCO->set(font, false);
if (!foundfont ) { if (!foundfont ) {
fontModule->fontsSansCO->addItemSort(font, font + qt_(" (not installed)"), fontModule->fontsSansCO->addItemSort(font, font + qt_(" (not installed)"),
qt_("Uninstalled used fonts"), qt_("Uninstalled used fonts"),
@ -4421,7 +4424,7 @@ void GuiDocument::paramsToDialog()
fontModule->font_sans = toqstr(bp_.fonts_sans[!bp_.useNonTeXFonts]); fontModule->font_sans = toqstr(bp_.fonts_sans[!bp_.useNonTeXFonts]);
font = toqstr(bp_.fontsTypewriter()); font = toqstr(bp_.fontsTypewriter());
foundfont = fontModule->fontsTypewriterCO->set(font); foundfont = fontModule->fontsTypewriterCO->set(font, false);
if (!foundfont) { if (!foundfont) {
fontModule->fontsTypewriterCO->addItemSort(font, font + qt_(" (not installed)"), fontModule->fontsTypewriterCO->addItemSort(font, font + qt_(" (not installed)"),
qt_("Uninstalled used fonts"), qt_("Uninstalled used fonts"),