forked from qt-creator/qt-creator
Core: Avoid duplicating options page
Creating an IOptionPage registers it automatically. In case an
IOptionsProvider is used this duplicates the the option pages
and although duplicated still adds them to the respective
category again.
If one clicks on the respective tab this results in a crash.
Slipped in with cc88302309
.
Change-Id: Ie881f532c3f0e397147d99ce368066cdce01a612
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -138,12 +138,13 @@ QIcon Core::IOptionsPage::categoryIcon() const
|
|||||||
static QList<Core::IOptionsPage *> g_optionsPages;
|
static QList<Core::IOptionsPage *> g_optionsPages;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs an options page with the given \a parent.
|
Constructs an options page with the given \a parent and registers it
|
||||||
|
at the global options page pool if \a registerGlobally is true.
|
||||||
*/
|
*/
|
||||||
Core::IOptionsPage::IOptionsPage(QObject *parent)
|
Core::IOptionsPage::IOptionsPage(QObject *parent, bool registerGlobally)
|
||||||
: QObject(parent),
|
: QObject(parent)
|
||||||
m_keywordsInitialized(false)
|
|
||||||
{
|
{
|
||||||
|
if (registerGlobally)
|
||||||
g_optionsPages.append(this);
|
g_optionsPages.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ class CORE_EXPORT IOptionsPage : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IOptionsPage(QObject *parent = 0);
|
IOptionsPage(QObject *parent = nullptr, bool registerGlobally = true);
|
||||||
virtual ~IOptionsPage();
|
virtual ~IOptionsPage();
|
||||||
|
|
||||||
static const QList<IOptionsPage *> allOptionsPages();
|
static const QList<IOptionsPage *> allOptionsPages();
|
||||||
@@ -73,7 +73,7 @@ protected:
|
|||||||
QString m_displayCategory;
|
QString m_displayCategory;
|
||||||
Utils::Icon m_categoryIcon;
|
Utils::Icon m_categoryIcon;
|
||||||
|
|
||||||
mutable bool m_keywordsInitialized;
|
mutable bool m_keywordsInitialized = false;
|
||||||
mutable QStringList m_keywords;
|
mutable QStringList m_keywords;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
using namespace Designer::Internal;
|
using namespace Designer::Internal;
|
||||||
|
|
||||||
SettingsPage::SettingsPage(QDesignerOptionsPageInterface *designerPage) :
|
SettingsPage::SettingsPage(QDesignerOptionsPageInterface *designerPage) :
|
||||||
|
Core::IOptionsPage(nullptr, false),
|
||||||
m_designerPage(designerPage)
|
m_designerPage(designerPage)
|
||||||
{
|
{
|
||||||
setId(Core::Id::fromString(m_designerPage->name()));
|
setId(Core::Id::fromString(m_designerPage->name()));
|
||||||
|
Reference in New Issue
Block a user