]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/CategorizedCombo.cpp
No need (any longer?) to create a new view for lyxfiles-open
[lyx.git] / src / frontends / qt / CategorizedCombo.cpp
index 9053228cbb2fbe2a7e92e0b2a3667355192f2588..0482e1c874fe14a9e6135679166543e0e9e33fa5 100644 (file)
@@ -34,9 +34,6 @@
 #include <QSortFilterProxyModel>
 #include <QStandardItemModel>
 #include <QTextFrame>
-#if QT_VERSION >= 0x060000
-#include <QtCore5Compat/QRegExp>
-#endif
 
 using namespace lyx::support;
 
@@ -273,11 +270,7 @@ QString CCItemDelegate::underlineFilter(QString const & s) const
        if (f.isEmpty())
                return s;
        QString r(s);
-#if QT_VERSION < 0x060000
-       QRegExp pattern(charFilterRegExpC(f));
-#else
        QRegularExpression pattern(charFilterRegExpC(f));
-#endif
        r.replace(pattern, "<u><b>\\1</b></u>");
        return r;
 }
@@ -294,7 +287,7 @@ void CategorizedCombo::Private::setFilter(QString const & s)
                lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
 
        filter_ = s;
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
        filterModel_->setFilterRegExp(charFilterRegExp(filter_));
 #else
        filterModel_->setFilterRegularExpression(charFilterRegExp(filter_));
@@ -449,7 +442,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 +457,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;
        }