forked from qt-creator/qt-creator
Port QtCreator over to use filterRegularExpression
QSortFilterProxyModel::filterRegExp is going to go away in Qt6, so port over to use QRegularExpression instead. This required some changes where setFilterWildcard/FixedString() was being used, as those would instantiate QRegExp based filters in Qt 5, and will use QRegularExpression in Qt 6. Use the generic setFilterRegularExpression here, to keep things portable between 5 and 6. Change-Id: I6379be781aa3821b10ba783c088f82c1a0970911 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -85,7 +85,7 @@ QList<Core::IOptionsPage *> SettingsPageProvider::pages() const
|
||||
return FormEditorW::optionsPages();
|
||||
}
|
||||
|
||||
bool SettingsPageProvider::matches(const QString &searchKeyWord) const
|
||||
bool SettingsPageProvider::matches(const QRegularExpression ®ex) const
|
||||
{
|
||||
// to avoid fully initializing designer when typing something in the options' filter edit
|
||||
// we hardcode matching of UI text from the designer pages, which are taken if the designer pages
|
||||
@@ -119,7 +119,7 @@ bool SettingsPageProvider::matches(const QString &searchKeyWord) const
|
||||
m_keywords << Utils::stripAccelerator(QCoreApplication::translate(uitext[i].context, uitext[i].value));
|
||||
}
|
||||
for (const QString &key : qAsConst(m_keywords)) {
|
||||
if (key.contains(searchKeyWord, Qt::CaseInsensitive))
|
||||
if (key.contains(regex))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user