#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
+#include "support/qstring_helpers.h"
#include <QAbstractTextDocumentLayout>
#include <QComboBox>
}
-static QString charFilterRegExpCC(QString const & filter)
-{
- QString re = ".*";
- for (int i = 0; i < filter.length(); ++i) {
- QChar c = filter[i];
- if (c.isLower())
- re += "[" + QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
- else
- re += QRegExp::escape(c);
- }
- return re;
-}
-
-
void CategorizedCombo::Private::setFilter(QString const & s)
{
bool enabled = p->view()->updatesEnabled();
lastSel_ = filterModel_->mapToSource(filterModel_->index(sel, 0)).row();
filter_ = s;
- filterModel_->setFilterRegExp(charFilterRegExpCC(filter_));
+ filterModel_->setFilterRegExp(charFilterRegExp(filter_));
countCategories();
// restore old selection
}
-static QString charFilterRegExp(QString const & filter)
-{
- QString re = ".*";
- for (int i = 0; i < filter.length(); ++i) {
- QChar c = filter[i];
- if (c.isLower())
- re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
- else
- re += QRegExp::escape(c);
- }
- return re;
-}
-
-
void LayoutBox::Private::setFilter(QString const & s)
{
// exit early if nothing has to be done
#include "support/debug.h"
#include "support/docstring.h"
+#include "support/qstring_helpers.h"
#include <QString>
#include <QVector>
return str.isEmpty() ? std::string() : std::string(str.toUtf8());
}
+QString charFilterRegExp(QString const & filter)
+{
+ QString re = ".*";
+ for (int i = 0; i < filter.length(); ++i) {
+ QChar c = filter[i];
+ if (c.isLower())
+ re += "["+ QRegExp::escape(c) + QRegExp::escape(c.toUpper()) + "]";
+ else
+ re += QRegExp::escape(c);
+ }
+ return re;
+}
+
} // namespace lyx
*/
std::string fromqstr(QString const & str);
+/**
+ * constructs a regex to filter on consecutive characters
+ */
+QString charFilterRegExp(QString const & filter);
+
} // namespace lyx
#endif // QSTRING_HELPERS_H