aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/dialogs/settingsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/coreplugin/dialogs/settingsdialog.cpp')
-rw-r--r--src/plugins/coreplugin/dialogs/settingsdialog.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
index 459af08a4a..24c78b6513 100644
--- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp
@@ -64,6 +64,8 @@ const int kMaxMinimumHeight = 250;
static const char pageKeyC[] = "General/LastPreferencePage";
const int categoryIconSize = 24;
+using namespace Utils;
+
namespace Core {
namespace Internal {
@@ -262,19 +264,18 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
if (QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent))
return true;
- const QString pattern = filterRegExp().pattern();
+ const QRegularExpression regex = filterRegularExpression();
const CategoryModel *cm = static_cast<CategoryModel*>(sourceModel());
const Category *category = cm->categories().at(sourceRow);
for (const IOptionsPage *page : category->pages) {
- if (page->displayCategory().contains(pattern, Qt::CaseInsensitive)
- || page->displayName().contains(pattern, Qt::CaseInsensitive)
- || page->matches(pattern))
+ if (page->displayCategory().contains(regex) || page->displayName().contains(regex)
+ || page->matches(regex))
return true;
}
if (!category->providerPagesCreated) {
for (const IOptionsPageProvider *provider : category->providers) {
- if (provider->matches(pattern))
+ if (provider->matches(regex))
return true;
}
}
@@ -469,8 +470,14 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
// The order of the slot connection matters here, the filter slot
// opens the matching page after the model has filtered.
- connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged,
- &m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
+ connect(m_filterLineEdit,
+ &Utils::FancyLineEdit::filterChanged,
+ &m_proxyModel,
+ [this](const QString &filter) {
+ m_proxyModel.setFilterRegularExpression(
+ QRegularExpression(QRegularExpression::escape(filter),
+ QRegularExpression::CaseInsensitiveOption));
+ });
connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged,
this, &SettingsDialog::filter);
m_categoryList->setFocus();
@@ -631,12 +638,12 @@ void SettingsDialog::disconnectTabWidgets()
void SettingsDialog::updateEnabledTabs(Category *category, const QString &searchText)
{
int firstEnabledTab = -1;
+ const QRegularExpression regex(QRegularExpression::escape(searchText),
+ QRegularExpression::CaseInsensitiveOption);
for (int i = 0; i < category->pages.size(); ++i) {
const IOptionsPage *page = category->pages.at(i);
- const bool enabled = searchText.isEmpty()
- || page->category().toString().contains(searchText, Qt::CaseInsensitive)
- || page->displayName().contains(searchText, Qt::CaseInsensitive)
- || page->matches(searchText);
+ const bool enabled = searchText.isEmpty() || page->category().toString().contains(regex)
+ || page->displayName().contains(regex) || page->matches(regex);
category->tabWidget->setTabEnabled(i, enabled);
if (enabled && firstEnabledTab < 0)
firstEnabledTab = i;