diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-12-03 14:17:03 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-12-10 13:31:48 +0100 |
commit | deb43b4c8a261855252aeee09fd6df283576932e (patch) | |
tree | a844379f47974fd681b86aa2187735e03639b567 /src/plugins/cpptools/cppfilesettingspage.cpp | |
parent | ea1a92484ac99057b06130a012164bf9788650e9 (diff) |
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/cppfilesettingspage.cpp')
-rw-r--r-- | src/plugins/cpptools/cppfilesettingspage.cpp | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index 1571e7ac220..48235be2d5c 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -293,21 +293,6 @@ CppFileSettings CppFileSettingsWidget::settings() const return rc; } -QString CppFileSettingsWidget::searchKeywords() const -{ - QString rc; - QTextStream(&rc) << m_ui->headersGroupBox->title() - << ' ' << m_ui->headerSuffixLabel->text() - << ' ' << m_ui->headerSearchPathsLabel->text() - << ' ' << m_ui->sourcesGroupBox->title() - << ' ' << m_ui->sourceSuffixLabel->text() - << ' ' << m_ui->sourceSearchPathsLabel->text() - << ' ' << m_ui->lowerCaseFileNamesCheckBox->text() - << ' ' << m_ui->licenseTemplateLabel->text(); - rc.remove(QLatin1Char('&')); - return rc; -} - static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0) { const int index = cb->findText(text); @@ -355,13 +340,13 @@ CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settin setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON)); } -QWidget *CppFileSettingsPage::createPage(QWidget *parent) +QWidget *CppFileSettingsPage::widget() { - m_widget = new CppFileSettingsWidget(parent); - m_widget->setSettings(*m_settings); - if (m_searchKeywords.isEmpty()) - m_searchKeywords = m_widget->searchKeywords(); + if (!m_widget) { + m_widget = new CppFileSettingsWidget; + m_widget->setSettings(*m_settings); + } return m_widget; } @@ -378,9 +363,9 @@ void CppFileSettingsPage::apply() } } -bool CppFileSettingsPage::matches(const QString &s) const +void CppFileSettingsPage::finish() { - return m_searchKeywords.contains(s, Qt::CaseInsensitive); + delete m_widget; } } // namespace Internal |