#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QTextFrame>
-#if QT_VERSION >= 0x060000
-#include <QtCore5Compat/QRegExp>
-#endif
using namespace lyx::support;
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;
}
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_));
}
-bool CategorizedCombo::set(QString const & item)
+bool CategorizedCombo::set(QString const & item, bool const report_missing)
{
d->resetFilter();
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;
}
void CategorizedCombo::addItemSort(QString const & item, QString const & guiname,
QString const & category, QString const & tooltip,
bool sorted, bool sortedByCat, bool sortCats,
- bool available)
+ bool available, bool nocategories)
{
QString titem = available ? guiname
: toqstr(bformat(_("Unavailable: %1$s"),
qstring_to_ucs4(guiname)));
bool const uncategorized = category.isEmpty();
- QString qcat = uncategorized ? qt_("Uncategorized") : category;
+ QString qcat = (uncategorized && !nocategories) ? qt_("Uncategorized") : category;
QList<QStandardItem *> row;
QStandardItem * gui = new QStandardItem(titem);