summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodemodelsettingspage.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-12-03 14:17:03 +0100
committerEike Ziller <eike.ziller@digia.com>2013-12-10 13:31:48 +0100
commitdeb43b4c8a261855252aeee09fd6df283576932e (patch)
treea844379f47974fd681b86aa2187735e03639b567 /src/plugins/cpptools/cppcodemodelsettingspage.cpp
parentea1a92484ac99057b06130a012164bf9788650e9 (diff)
downloadqt-creator-deb43b4c8a261855252aeee09fd6df283576932e.tar.gz
Preferences: Add default implementation for filtering
The default "matches" method now takes the widget and looks for all child labels, checkboxes, push buttons and group boxes. Because of that, the former "createWidget" method can be called multiple times without creating a new widget (-->widget()), and the "finished" method must ensure that the created widget gets deleted, since not all widgets that were created are added to the UI anymore. Change-Id: Ia231c7c78dd8819146668e6447d36d22e7836904 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodemodelsettingspage.cpp')
-rw-r--r--src/plugins/cpptools/cppcodemodelsettingspage.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/plugins/cpptools/cppcodemodelsettingspage.cpp b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
index e5fd37824a..7202ea2828 100644
--- a/src/plugins/cpptools/cppcodemodelsettingspage.cpp
+++ b/src/plugins/cpptools/cppcodemodelsettingspage.cpp
@@ -101,23 +101,6 @@ void CppCodeModelSettingsWidget::applyToSettings() const
m_settings->toSettings(Core::ICore::settings());
}
-QString CppCodeModelSettingsWidget::searchKeywords() const
-{
- QString rc;
- QTextStream ts(&rc);
- ts << m_ui->theGroupBox->title()
- << ' ' << m_ui->cLabel->text()
- << ' ' << m_ui->cppLabel->text()
- << ' ' << m_ui->objcLabel->text()
- << ' ' << m_ui->objcppLabel->text()
- << ' ' << m_ui->anotherGroupBox->title()
- << ' ' << m_ui->ignorePCHCheckBox->text();
- foreach (const QString &mmsNames, m_settings->availableModelManagerSupportersByName().keys())
- ts << ' ' << mmsNames;
- rc.remove(QLatin1Char('&'));
- return rc;
-}
-
bool CppCodeModelSettingsWidget::applyToSettings(QComboBox *chooser, const QString &mimeType) const
{
QString newId = chooser->itemData(chooser->currentIndex()).toString();
@@ -141,12 +124,12 @@ CppCodeModelSettingsPage::CppCodeModelSettingsPage(QSharedPointer<CppCodeModelSe
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON));
}
-QWidget *CppCodeModelSettingsPage::createPage(QWidget *parent)
+QWidget *CppCodeModelSettingsPage::widget()
{
- m_widget = new CppCodeModelSettingsWidget(parent);
- m_widget->setSettings(m_settings);
- if (m_searchKeywords.isEmpty())
- m_searchKeywords = m_widget->searchKeywords();
+ if (!m_widget) {
+ m_widget = new CppCodeModelSettingsWidget;
+ m_widget->setSettings(m_settings);
+ }
return m_widget;
}
@@ -156,7 +139,7 @@ void CppCodeModelSettingsPage::apply()
m_widget->applyToSettings();
}
-bool CppCodeModelSettingsPage::matches(const QString &s) const
+void CppCodeModelSettingsPage::finish()
{
- return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+ delete m_widget;
}