diff options
author | con <qtc-committer@nokia.com> | 2010-12-02 18:28:16 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-12-06 11:18:58 +0100 |
commit | 773343f396adb765e3b1837b3d961045e2a10056 (patch) | |
tree | f0708f1718a47185e9da54f649d42d568a08944b /src/plugins/cpptools | |
parent | 5c99316624d59463d24096ff5ffadd1e58e4d12e (diff) | |
download | qt-creator-773343f396adb765e3b1837b3d961045e2a10056.tar.gz |
Delay widget creation of options pages till their category is shown
Also add the alternative way: IOptionsPageProvider, which states
a category, and is asked for a list of options pages for that
category when it is shown.
Task-number: QTCREATORBUG-3131
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r-- | src/plugins/cpptools/completionsettingspage.cpp | 13 | ||||
-rw-r--r-- | src/plugins/cpptools/completionsettingspage.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/cpptools/completionsettingspage.cpp b/src/plugins/cpptools/completionsettingspage.cpp index 2db7dc3087..995ee2d7d8 100644 --- a/src/plugins/cpptools/completionsettingspage.cpp +++ b/src/plugins/cpptools/completionsettingspage.cpp @@ -40,7 +40,7 @@ using namespace CppTools::Internal; CompletionSettingsPage::CompletionSettingsPage() - : m_page(new Ui_CompletionSettingsPage) + : m_page(0) { } @@ -62,6 +62,7 @@ QString CompletionSettingsPage::displayName() const QWidget *CompletionSettingsPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); + m_page = new Ui_CompletionSettingsPage; m_page->setupUi(w); const TextEditor::CompletionSettings &settings = @@ -113,6 +114,8 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent) void CompletionSettingsPage::apply() { + if (!m_page) // page was never shown + return; TextEditor::CompletionSettings settings; settings.m_caseSensitivity = caseSensitivity(); settings.m_completionTrigger = completionTrigger(); @@ -151,3 +154,11 @@ TextEditor::CompletionTrigger CompletionSettingsPage::completionTrigger() const return TextEditor::AutomaticCompletion; } } + +void CompletionSettingsPage::finish() +{ + if (!m_page) // page was never shown + return; + delete m_page; + m_page = 0; +} diff --git a/src/plugins/cpptools/completionsettingspage.h b/src/plugins/cpptools/completionsettingspage.h index c2b0c56dc3..25ceac1258 100644 --- a/src/plugins/cpptools/completionsettingspage.h +++ b/src/plugins/cpptools/completionsettingspage.h @@ -55,7 +55,7 @@ public: QWidget *createPage(QWidget *parent); void apply(); - void finish() { } + void finish(); virtual bool matches(const QString &) const; private: |