forked from qt-creator/qt-creator
Remove unnecessary removeContextObject calls
They are removed on deletion now. Change-Id: I08461ea4938e24ab450df013a0f8f820032381da Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1560,9 +1560,3 @@ AndroidManifestTextEditorWidget::AndroidManifestTextEditorWidget(AndroidManifest
|
|||||||
m_context->setContext(Core::Context(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT));
|
m_context->setContext(Core::Context(Constants::ANDROID_MANIFEST_EDITOR_CONTEXT));
|
||||||
Core::ICore::addContextObject(m_context);
|
Core::ICore::addContextObject(m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidManifestTextEditorWidget::~AndroidManifestTextEditorWidget()
|
|
||||||
{
|
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -79,7 +79,6 @@ class AndroidManifestTextEditorWidget : public TextEditor::TextEditorWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AndroidManifestTextEditorWidget(AndroidManifestEditorWidget *parent);
|
explicit AndroidManifestTextEditorWidget(AndroidManifestEditorWidget *parent);
|
||||||
~AndroidManifestTextEditorWidget() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::IContext *m_context;
|
Core::IContext *m_context;
|
||||||
|
@@ -211,11 +211,6 @@ BookmarkView::BookmarkView(BookmarkManager *manager) :
|
|||||||
connect(this, &QAbstractItemView::activated, this, &BookmarkView::gotoBookmark);
|
connect(this, &QAbstractItemView::activated, this, &BookmarkView::gotoBookmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkView::~BookmarkView()
|
|
||||||
{
|
|
||||||
ICore::removeContextObject(m_bookmarkContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QToolButton *> BookmarkView::createToolBarWidgets()
|
QList<QToolButton *> BookmarkView::createToolBarWidgets()
|
||||||
{
|
{
|
||||||
Command *prevCmd = ActionManager::command(Constants::BOOKMARKS_PREV_ACTION);
|
Command *prevCmd = ActionManager::command(Constants::BOOKMARKS_PREV_ACTION);
|
||||||
|
@@ -128,7 +128,6 @@ class BookmarkView final : public Utils::ListView
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BookmarkView(BookmarkManager *manager);
|
explicit BookmarkView(BookmarkManager *manager);
|
||||||
~BookmarkView() final;
|
|
||||||
|
|
||||||
QList<QToolButton *> createToolBarWidgets();
|
QList<QToolButton *> createToolBarWidgets();
|
||||||
|
|
||||||
|
@@ -61,7 +61,6 @@ EditorArea::~EditorArea()
|
|||||||
disconnect(qApp, &QApplication::focusChanged,
|
disconnect(qApp, &QApplication::focusChanged,
|
||||||
this, &EditorArea::focusChanged);
|
this, &EditorArea::focusChanged);
|
||||||
|
|
||||||
ICore::removeContextObject(m_context);
|
|
||||||
delete m_context;
|
delete m_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,9 +109,6 @@ IOutputPane::IOutputPane(QObject *parent)
|
|||||||
|
|
||||||
IOutputPane::~IOutputPane()
|
IOutputPane::~IOutputPane()
|
||||||
{
|
{
|
||||||
if (m_context)
|
|
||||||
ICore::removeContextObject(m_context);
|
|
||||||
|
|
||||||
const int i = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::pane, this));
|
const int i = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::pane, this));
|
||||||
QTC_ASSERT(i >= 0, return);
|
QTC_ASSERT(i >= 0, return);
|
||||||
delete g_outputPanes.at(i).button;
|
delete g_outputPanes.at(i).button;
|
||||||
|
@@ -66,13 +66,6 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~OutputWindowPrivate()
|
|
||||||
{
|
|
||||||
ICore::removeContextObject(outputWindowContext);
|
|
||||||
delete outputWindowContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
IContext *outputWindowContext = nullptr;
|
|
||||||
QString settingsKey;
|
QString settingsKey;
|
||||||
OutputFormatter formatter;
|
OutputFormatter formatter;
|
||||||
QList<QPair<QString, OutputFormat>> queuedOutput;
|
QList<QPair<QString, OutputFormat>> queuedOutput;
|
||||||
@@ -116,10 +109,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
|
|||||||
|
|
||||||
d->settingsKey = settingsKey;
|
d->settingsKey = settingsKey;
|
||||||
|
|
||||||
d->outputWindowContext = new IContext;
|
auto outputWindowContext = new IContext(this);
|
||||||
d->outputWindowContext->setContext(context);
|
outputWindowContext->setContext(context);
|
||||||
d->outputWindowContext->setWidget(this);
|
outputWindowContext->setWidget(this);
|
||||||
ICore::addContextObject(d->outputWindowContext);
|
ICore::addContextObject(outputWindowContext);
|
||||||
|
|
||||||
auto undoAction = new QAction(this);
|
auto undoAction = new QAction(this);
|
||||||
auto redoAction = new QAction(this);
|
auto redoAction = new QAction(this);
|
||||||
|
@@ -98,9 +98,9 @@ static void createStatusBarManager()
|
|||||||
bar->insertPermanentWidget(1, rightCornerWidget);
|
bar->insertPermanentWidget(1, rightCornerWidget);
|
||||||
m_statusBarWidgets.append(rightCornerWidget);
|
m_statusBarWidgets.append(rightCornerWidget);
|
||||||
|
|
||||||
auto context = new StatusBarContext(bar);
|
auto statusContext = new StatusBarContext(bar);
|
||||||
context->setWidget(bar);
|
statusContext->setWidget(bar);
|
||||||
ICore::addContextObject(context);
|
ICore::addContextObject(statusContext);
|
||||||
|
|
||||||
QObject::connect(ICore::instance(), &ICore::saveSettingsRequested, [] {
|
QObject::connect(ICore::instance(), &ICore::saveSettingsRequested, [] {
|
||||||
QSettings *s = ICore::settings();
|
QSettings *s = ICore::settings();
|
||||||
@@ -109,7 +109,8 @@ static void createStatusBarManager()
|
|||||||
s->endGroup();
|
s->endGroup();
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(ICore::instance(), &ICore::coreAboutToClose, [] {
|
QObject::connect(ICore::instance(), &ICore::coreAboutToClose, [statusContext] {
|
||||||
|
delete statusContext;
|
||||||
// This is the catch-all on rampdown. Individual items may
|
// This is the catch-all on rampdown. Individual items may
|
||||||
// have been removed earlier by destroyStatusBarWidget().
|
// have been removed earlier by destroyStatusBarWidget().
|
||||||
for (const QPointer<IContext> &context : m_contexts) {
|
for (const QPointer<IContext> &context : m_contexts) {
|
||||||
@@ -144,8 +145,8 @@ void StatusBarManager::destroyStatusBarWidget(QWidget *widget)
|
|||||||
QTC_ASSERT(widget, return);
|
QTC_ASSERT(widget, return);
|
||||||
for (const QPointer<IContext> &context : m_contexts) {
|
for (const QPointer<IContext> &context : m_contexts) {
|
||||||
if (context->widget() == widget) {
|
if (context->widget() == widget) {
|
||||||
ICore::removeContextObject(context);
|
|
||||||
m_contexts.removeAll(context);
|
m_contexts.removeAll(context);
|
||||||
|
delete context;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,7 +91,6 @@ WindowSupport::~WindowSupport()
|
|||||||
ActionManager::unregisterAction(m_closeAction, Constants::CLOSE_WINDOW);
|
ActionManager::unregisterAction(m_closeAction, Constants::CLOSE_WINDOW);
|
||||||
}
|
}
|
||||||
ActionManager::unregisterAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
|
ActionManager::unregisterAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
|
||||||
ICore::removeContextObject(m_contextObject);
|
|
||||||
m_windowList->removeWindow(m_window);
|
m_windowList->removeWindow(m_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -211,7 +211,6 @@ public:
|
|||||||
QMenu *m_previewInStyleMenu = nullptr;
|
QMenu *m_previewInStyleMenu = nullptr;
|
||||||
QAction *m_actionAboutPlugins = nullptr;
|
QAction *m_actionAboutPlugins = nullptr;
|
||||||
|
|
||||||
DesignerContext *m_context = nullptr;
|
|
||||||
Context m_contexts;
|
Context m_contexts;
|
||||||
|
|
||||||
QList<Id> m_toolActionIds;
|
QList<Id> m_toolActionIds;
|
||||||
@@ -275,8 +274,6 @@ FormEditorData::FormEditorData() :
|
|||||||
|
|
||||||
FormEditorData::~FormEditorData()
|
FormEditorData::~FormEditorData()
|
||||||
{
|
{
|
||||||
if (m_context)
|
|
||||||
ICore::removeContextObject(m_context);
|
|
||||||
if (m_initStage == FormEditorW::FullyInitialized) {
|
if (m_initStage == FormEditorW::FullyInitialized) {
|
||||||
QSettings *s = ICore::settings();
|
QSettings *s = ICore::settings();
|
||||||
s->beginGroup(settingsGroupC);
|
s->beginGroup(settingsGroupC);
|
||||||
@@ -423,8 +420,7 @@ void FormEditorData::fullInit()
|
|||||||
|
|
||||||
Context designerContexts = m_contexts;
|
Context designerContexts = m_contexts;
|
||||||
designerContexts.add(Core::Constants::C_EDITORMANAGER);
|
designerContexts.add(Core::Constants::C_EDITORMANAGER);
|
||||||
m_context = new DesignerContext(designerContexts, m_modeWidget, m_instance);
|
ICore::addContextObject(new DesignerContext(designerContexts, m_modeWidget, m_instance));
|
||||||
ICore::addContextObject(m_context);
|
|
||||||
|
|
||||||
DesignMode::registerDesignWidget(m_modeWidget, QStringList(FORM_MIMETYPE), m_contexts);
|
DesignMode::registerDesignWidget(m_modeWidget, QStringList(FORM_MIMETYPE), m_contexts);
|
||||||
|
|
||||||
|
@@ -77,16 +77,12 @@ class DescriptionEditorWidget : public TextEditorWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DescriptionEditorWidget(QWidget *parent = nullptr);
|
DescriptionEditorWidget(QWidget *parent = nullptr);
|
||||||
~DescriptionEditorWidget() override;
|
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDisplaySettings(const DisplaySettings &ds) override;
|
void setDisplaySettings(const DisplaySettings &ds) override;
|
||||||
void setMarginSettings(const MarginSettings &ms) override;
|
void setMarginSettings(const MarginSettings &ms) override;
|
||||||
|
|
||||||
private:
|
|
||||||
Core::IContext *m_context;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
|
DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
|
||||||
@@ -107,19 +103,14 @@ DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
|
|||||||
|
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
|
||||||
m_context = new Core::IContext(this);
|
auto context = new Core::IContext(this);
|
||||||
m_context->setWidget(this);
|
context->setWidget(this);
|
||||||
m_context->setContext(Core::Context(Constants::C_DIFF_EDITOR_DESCRIPTION));
|
context->setContext(Core::Context(Constants::C_DIFF_EDITOR_DESCRIPTION));
|
||||||
Core::ICore::addContextObject(m_context);
|
Core::ICore::addContextObject(context);
|
||||||
|
|
||||||
textDocument()->setSyntaxHighlighter(new SyntaxHighlighter);
|
textDocument()->setSyntaxHighlighter(new SyntaxHighlighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptionEditorWidget::~DescriptionEditorWidget()
|
|
||||||
{
|
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize DescriptionEditorWidget::sizeHint() const
|
QSize DescriptionEditorWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
QSize size = TextEditorWidget::sizeHint();
|
QSize size = TextEditorWidget::sizeHint();
|
||||||
|
@@ -802,20 +802,14 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
|
|||||||
l->addWidget(m_splitter);
|
l->addWidget(m_splitter);
|
||||||
setFocusProxy(m_leftEditor);
|
setFocusProxy(m_leftEditor);
|
||||||
|
|
||||||
m_leftContext = new IContext(this);
|
auto leftContext = new IContext(this);
|
||||||
m_leftContext->setWidget(m_leftEditor);
|
leftContext->setWidget(m_leftEditor);
|
||||||
m_leftContext->setContext(Core::Context(Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(1)));
|
leftContext->setContext(Core::Context(Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(1)));
|
||||||
Core::ICore::addContextObject(m_leftContext);
|
Core::ICore::addContextObject(leftContext);
|
||||||
m_rightContext = new IContext(this);
|
auto rightContext = new IContext(this);
|
||||||
m_rightContext->setWidget(m_rightEditor);
|
rightContext->setWidget(m_rightEditor);
|
||||||
m_rightContext->setContext(Core::Context(Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(2)));
|
rightContext->setContext(Core::Context(Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(2)));
|
||||||
Core::ICore::addContextObject(m_rightContext);
|
Core::ICore::addContextObject(rightContext);
|
||||||
}
|
|
||||||
|
|
||||||
SideBySideDiffEditorWidget::~SideBySideDiffEditorWidget()
|
|
||||||
{
|
|
||||||
Core::ICore::removeContextObject(m_leftContext);
|
|
||||||
Core::ICore::removeContextObject(m_rightContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditorWidget *SideBySideDiffEditorWidget::leftEditorWidget() const
|
TextEditorWidget *SideBySideDiffEditorWidget::leftEditorWidget() const
|
||||||
|
@@ -56,7 +56,6 @@ class SideBySideDiffEditorWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SideBySideDiffEditorWidget(QWidget *parent = nullptr);
|
explicit SideBySideDiffEditorWidget(QWidget *parent = nullptr);
|
||||||
~SideBySideDiffEditorWidget() override;
|
|
||||||
|
|
||||||
TextEditor::TextEditorWidget *leftEditorWidget() const;
|
TextEditor::TextEditorWidget *leftEditorWidget() const;
|
||||||
TextEditor::TextEditorWidget *rightEditorWidget() const;
|
TextEditor::TextEditorWidget *rightEditorWidget() const;
|
||||||
@@ -109,8 +108,6 @@ private:
|
|||||||
bool m_horizontalSync = false;
|
bool m_horizontalSync = false;
|
||||||
|
|
||||||
QTextCharFormat m_spanLineFormat;
|
QTextCharFormat m_spanLineFormat;
|
||||||
Core::IContext *m_leftContext = nullptr;
|
|
||||||
Core::IContext *m_rightContext = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -77,18 +77,13 @@ UnifiedDiffEditorWidget::UnifiedDiffEditorWidget(QWidget *parent)
|
|||||||
connect(this, &QPlainTextEdit::cursorPositionChanged,
|
connect(this, &QPlainTextEdit::cursorPositionChanged,
|
||||||
this, &UnifiedDiffEditorWidget::slotCursorPositionChangedInEditor);
|
this, &UnifiedDiffEditorWidget::slotCursorPositionChangedInEditor);
|
||||||
|
|
||||||
m_context = new Core::IContext(this);
|
auto context = new Core::IContext(this);
|
||||||
m_context->setWidget(this);
|
context->setWidget(this);
|
||||||
m_context->setContext(Core::Context(Constants::UNIFIED_VIEW_ID));
|
context->setContext(Core::Context(Constants::UNIFIED_VIEW_ID));
|
||||||
Core::ICore::addContextObject(m_context);
|
Core::ICore::addContextObject(context);
|
||||||
setCodeFoldingSupported(true);
|
setCodeFoldingSupported(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnifiedDiffEditorWidget::~UnifiedDiffEditorWidget()
|
|
||||||
{
|
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UnifiedDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
void UnifiedDiffEditorWidget::setDocument(DiffEditorDocument *document)
|
||||||
{
|
{
|
||||||
m_controller.setDocument(document);
|
m_controller.setDocument(document);
|
||||||
|
@@ -50,7 +50,6 @@ class UnifiedDiffEditorWidget : public SelectableTextEditorWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UnifiedDiffEditorWidget(QWidget *parent = nullptr);
|
UnifiedDiffEditorWidget(QWidget *parent = nullptr);
|
||||||
~UnifiedDiffEditorWidget() override;
|
|
||||||
|
|
||||||
void setDocument(DiffEditorDocument *document);
|
void setDocument(DiffEditorDocument *document);
|
||||||
DiffEditorDocument *diffDocument() const;
|
DiffEditorDocument *diffDocument() const;
|
||||||
@@ -117,7 +116,6 @@ private:
|
|||||||
QMap<int, QPair<int, int> > m_chunkInfo;
|
QMap<int, QPair<int, int> > m_chunkInfo;
|
||||||
|
|
||||||
QByteArray m_state;
|
QByteArray m_state;
|
||||||
Core::IContext *m_context = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -548,7 +548,6 @@ HelpWidget::~HelpWidget()
|
|||||||
if (m_openPagesAction)
|
if (m_openPagesAction)
|
||||||
Core::ActionManager::unregisterAction(m_openPagesAction, Constants::HELP_OPENPAGES);
|
Core::ActionManager::unregisterAction(m_openPagesAction, Constants::HELP_OPENPAGES);
|
||||||
}
|
}
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
Core::ActionManager::unregisterAction(m_copy, Core::Constants::COPY);
|
Core::ActionManager::unregisterAction(m_copy, Core::Constants::COPY);
|
||||||
Core::ActionManager::unregisterAction(m_printAction, Core::Constants::PRINT);
|
Core::ActionManager::unregisterAction(m_printAction, Core::Constants::PRINT);
|
||||||
if (m_toggleSideBarAction)
|
if (m_toggleSideBarAction)
|
||||||
|
@@ -299,10 +299,10 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
|
|||||||
m_crumbContainer(new QWidget(this)),
|
m_crumbContainer(new QWidget(this)),
|
||||||
m_crumbLabel(new DelayedFileCrumbLabel(this))
|
m_crumbLabel(new DelayedFileCrumbLabel(this))
|
||||||
{
|
{
|
||||||
m_context = new Core::IContext(this);
|
auto context = new Core::IContext(this);
|
||||||
m_context->setContext(Core::Context(C_FOLDERNAVIGATIONWIDGET));
|
context->setContext(Core::Context(C_FOLDERNAVIGATIONWIDGET));
|
||||||
m_context->setWidget(this);
|
context->setWidget(this);
|
||||||
Core::ICore::addContextObject(m_context);
|
Core::ICore::addContextObject(context);
|
||||||
|
|
||||||
setBackgroundRole(QPalette::Base);
|
setBackgroundRole(QPalette::Base);
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
@@ -435,11 +435,6 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
|
|||||||
setRootAutoSynchronization(true);
|
setRootAutoSynchronization(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderNavigationWidget::~FolderNavigationWidget()
|
|
||||||
{
|
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FolderNavigationWidget::toggleAutoSynchronization()
|
void FolderNavigationWidget::toggleAutoSynchronization()
|
||||||
{
|
{
|
||||||
setAutoSynchronization(!m_autoSync);
|
setAutoSynchronization(!m_autoSync);
|
||||||
|
@@ -94,7 +94,6 @@ class FolderNavigationWidget : public QWidget
|
|||||||
Q_PROPERTY(bool autoSynchronization READ autoSynchronization WRITE setAutoSynchronization)
|
Q_PROPERTY(bool autoSynchronization READ autoSynchronization WRITE setAutoSynchronization)
|
||||||
public:
|
public:
|
||||||
explicit FolderNavigationWidget(QWidget *parent = nullptr);
|
explicit FolderNavigationWidget(QWidget *parent = nullptr);
|
||||||
~FolderNavigationWidget() override;
|
|
||||||
|
|
||||||
static QStringList projectFilesInDirectory(const QString &path);
|
static QStringList projectFilesInDirectory(const QString &path);
|
||||||
|
|
||||||
@@ -135,7 +134,6 @@ private:
|
|||||||
void openProjectsInDirectory(const QModelIndex &index);
|
void openProjectsInDirectory(const QModelIndex &index);
|
||||||
void createNewFolder(const QModelIndex &parent);
|
void createNewFolder(const QModelIndex &parent);
|
||||||
|
|
||||||
Core::IContext *m_context = nullptr;
|
|
||||||
Utils::NavigationTreeView *m_listView = nullptr;
|
Utils::NavigationTreeView *m_listView = nullptr;
|
||||||
QFileSystemModel *m_fileSystemModel = nullptr;
|
QFileSystemModel *m_fileSystemModel = nullptr;
|
||||||
QSortFilterProxyModel *m_sortProxyModel = nullptr;
|
QSortFilterProxyModel *m_sortProxyModel = nullptr;
|
||||||
|
@@ -152,11 +152,11 @@ public:
|
|||||||
setDragDropMode(QAbstractItemView::DragDrop);
|
setDragDropMode(QAbstractItemView::DragDrop);
|
||||||
viewport()->setAcceptDrops(true);
|
viewport()->setAcceptDrops(true);
|
||||||
setDropIndicatorShown(true);
|
setDropIndicatorShown(true);
|
||||||
m_context = new IContext(this);
|
auto context = new IContext(this);
|
||||||
m_context->setContext(Context(ProjectExplorer::Constants::C_PROJECT_TREE));
|
context->setContext(Context(ProjectExplorer::Constants::C_PROJECT_TREE));
|
||||||
m_context->setWidget(this);
|
context->setWidget(this);
|
||||||
|
|
||||||
ICore::addContextObject(m_context);
|
ICore::addContextObject(context);
|
||||||
|
|
||||||
connect(this, &ProjectTreeView::expanded,
|
connect(this, &ProjectTreeView::expanded,
|
||||||
this, &ProjectTreeView::invalidateSize);
|
this, &ProjectTreeView::invalidateSize);
|
||||||
@@ -204,12 +204,6 @@ public:
|
|||||||
NavigationTreeView::setModel(newModel);
|
NavigationTreeView::setModel(newModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ProjectTreeView() override
|
|
||||||
{
|
|
||||||
ICore::removeContextObject(m_context);
|
|
||||||
delete m_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sizeHintForColumn(int column) const override
|
int sizeHintForColumn(int column) const override
|
||||||
{
|
{
|
||||||
if (m_cachedSize < 0)
|
if (m_cachedSize < 0)
|
||||||
@@ -220,7 +214,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable int m_cachedSize = -1;
|
mutable int m_cachedSize = -1;
|
||||||
IContext *m_context;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -397,7 +397,6 @@ TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
|
|||||||
|
|
||||||
TaskWindow::~TaskWindow()
|
TaskWindow::~TaskWindow()
|
||||||
{
|
{
|
||||||
Core::ICore::removeContextObject(d->m_taskWindowContext);
|
|
||||||
delete d->m_filterWarningsButton;
|
delete d->m_filterWarningsButton;
|
||||||
delete d->m_listview;
|
delete d->m_listview;
|
||||||
delete d->m_filter;
|
delete d->m_filter;
|
||||||
|
@@ -68,9 +68,6 @@ BindingEditorWidget::BindingEditorWidget()
|
|||||||
BindingEditorWidget::~BindingEditorWidget()
|
BindingEditorWidget::~BindingEditorWidget()
|
||||||
{
|
{
|
||||||
unregisterAutoCompletion();
|
unregisterAutoCompletion();
|
||||||
|
|
||||||
Core::ICore::removeContextObject(m_context);
|
|
||||||
delete m_context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BindingEditorWidget::unregisterAutoCompletion()
|
void BindingEditorWidget::unregisterAutoCompletion()
|
||||||
|
@@ -118,7 +118,6 @@ public:
|
|||||||
SettingsPage settingsPage;
|
SettingsPage settingsPage;
|
||||||
DesignModeWidget mainWidget;
|
DesignModeWidget mainWidget;
|
||||||
DesignerSettings settings;
|
DesignerSettings settings;
|
||||||
DesignModeContext *context = nullptr;
|
|
||||||
QtQuickDesignerFactory m_qtQuickDesignerFactory;
|
QtQuickDesignerFactory m_qtQuickDesignerFactory;
|
||||||
bool blockEditorChange = false;
|
bool blockEditorChange = false;
|
||||||
};
|
};
|
||||||
@@ -194,11 +193,8 @@ QmlDesignerPlugin::QmlDesignerPlugin()
|
|||||||
|
|
||||||
QmlDesignerPlugin::~QmlDesignerPlugin()
|
QmlDesignerPlugin::~QmlDesignerPlugin()
|
||||||
{
|
{
|
||||||
if (d) {
|
if (d)
|
||||||
Core::DesignMode::unregisterDesignWidget(&d->mainWidget);
|
Core::DesignMode::unregisterDesignWidget(&d->mainWidget);
|
||||||
Core::ICore::removeContextObject(d->context);
|
|
||||||
d->context = nullptr;
|
|
||||||
}
|
|
||||||
delete d;
|
delete d;
|
||||||
d = nullptr;
|
d = nullptr;
|
||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
@@ -290,18 +286,18 @@ static QString projectPath(const Utils::FilePath &fileName)
|
|||||||
|
|
||||||
void QmlDesignerPlugin::integrateIntoQtCreator(QWidget *modeWidget)
|
void QmlDesignerPlugin::integrateIntoQtCreator(QWidget *modeWidget)
|
||||||
{
|
{
|
||||||
d->context = new Internal::DesignModeContext(modeWidget);
|
auto context = new Internal::DesignModeContext(modeWidget);
|
||||||
Core::ICore::addContextObject(d->context);
|
Core::ICore::addContextObject(context);
|
||||||
Core::Context qmlDesignerMainContext(Constants::C_QMLDESIGNER);
|
Core::Context qmlDesignerMainContext(Constants::C_QMLDESIGNER);
|
||||||
Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR);
|
Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR);
|
||||||
Core::Context qmlDesignerEditor3dContext(Constants::C_QMLEDITOR3D);
|
Core::Context qmlDesignerEditor3dContext(Constants::C_QMLEDITOR3D);
|
||||||
Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR);
|
Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR);
|
||||||
|
|
||||||
d->context->context().add(qmlDesignerMainContext);
|
context->context().add(qmlDesignerMainContext);
|
||||||
d->context->context().add(qmlDesignerFormEditorContext);
|
context->context().add(qmlDesignerFormEditorContext);
|
||||||
d->context->context().add(qmlDesignerEditor3dContext);
|
context->context().add(qmlDesignerEditor3dContext);
|
||||||
d->context->context().add(qmlDesignerNavigatorContext);
|
context->context().add(qmlDesignerNavigatorContext);
|
||||||
d->context->context().add(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
|
context->context().add(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID);
|
||||||
|
|
||||||
d->shortCutManager.registerActions(qmlDesignerMainContext, qmlDesignerFormEditorContext,
|
d->shortCutManager.registerActions(qmlDesignerMainContext, qmlDesignerFormEditorContext,
|
||||||
qmlDesignerEditor3dContext, qmlDesignerNavigatorContext);
|
qmlDesignerEditor3dContext, qmlDesignerNavigatorContext);
|
||||||
@@ -309,7 +305,7 @@ void QmlDesignerPlugin::integrateIntoQtCreator(QWidget *modeWidget)
|
|||||||
const QStringList mimeTypes = { QmlJSTools::Constants::QML_MIMETYPE,
|
const QStringList mimeTypes = { QmlJSTools::Constants::QML_MIMETYPE,
|
||||||
QmlJSTools::Constants::QMLUI_MIMETYPE };
|
QmlJSTools::Constants::QMLUI_MIMETYPE };
|
||||||
|
|
||||||
Core::DesignMode::registerDesignWidget(modeWidget, mimeTypes, d->context->context());
|
Core::DesignMode::registerDesignWidget(modeWidget, mimeTypes, context->context());
|
||||||
|
|
||||||
connect(Core::DesignMode::instance(), &Core::DesignMode::actionsUpdated,
|
connect(Core::DesignMode::instance(), &Core::DesignMode::actionsUpdated,
|
||||||
&d->shortCutManager, &ShortCutManager::updateActions);
|
&d->shortCutManager, &ShortCutManager::updateActions);
|
||||||
|
@@ -111,9 +111,6 @@ ScxmlEditorData::ScxmlEditorData()
|
|||||||
|
|
||||||
ScxmlEditorData::~ScxmlEditorData()
|
ScxmlEditorData::~ScxmlEditorData()
|
||||||
{
|
{
|
||||||
if (m_context)
|
|
||||||
ICore::removeContextObject(m_context);
|
|
||||||
|
|
||||||
if (m_modeWidget) {
|
if (m_modeWidget) {
|
||||||
DesignMode::unregisterDesignWidget(m_modeWidget);
|
DesignMode::unregisterDesignWidget(m_modeWidget);
|
||||||
delete m_modeWidget;
|
delete m_modeWidget;
|
||||||
@@ -146,8 +143,8 @@ void ScxmlEditorData::fullInit()
|
|||||||
|
|
||||||
Context scxmlContexts = m_contexts;
|
Context scxmlContexts = m_contexts;
|
||||||
scxmlContexts.add(Core::Constants::C_EDITORMANAGER);
|
scxmlContexts.add(Core::Constants::C_EDITORMANAGER);
|
||||||
m_context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
|
auto context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
|
||||||
ICore::addContextObject(m_context);
|
ICore::addContextObject(context);
|
||||||
|
|
||||||
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,6 @@ private:
|
|||||||
QWidget *createModeWidget();
|
QWidget *createModeWidget();
|
||||||
EditorToolBar *createMainToolBar();
|
EditorToolBar *createMainToolBar();
|
||||||
|
|
||||||
ScxmlContext *m_context = nullptr;
|
|
||||||
Context m_contexts;
|
Context m_contexts;
|
||||||
QWidget *m_modeWidget = nullptr;
|
QWidget *m_modeWidget = nullptr;
|
||||||
ScxmlEditorStack *m_widgetStack = nullptr;
|
ScxmlEditorStack *m_widgetStack = nullptr;
|
||||||
|
Reference in New Issue
Block a user