summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-05-26 16:07:10 +0200
committerEike Ziller <eike.ziller@qt.io>2020-05-27 08:42:37 +0000
commit83843fbd06f9af1c3256f7877fd4cfb17d464218 (patch)
tree01bc9b6955b10f2e060417201c68298dad8b7880
parente5bb7d1ffebbba90aa2c1098c1ff67694dd0fdaf (diff)
downloadqt-creator-83843fbd06f9af1c3256f7877fd4cfb17d464218.tar.gz
Remove some useless IContext subclasses
They are only created at single places anyhow, so use the setters of IContext instead Change-Id: I00a089c9f1ea151c76cb6443e2a24c4a05437bbb Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp20
-rw-r--r--src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp3
-rw-r--r--src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.h14
-rw-r--r--src/plugins/scxmleditor/CMakeLists.txt1
-rw-r--r--src/plugins/scxmleditor/scxmlcontext.cpp35
-rw-r--r--src/plugins/scxmleditor/scxmlcontext.h40
-rw-r--r--src/plugins/scxmleditor/scxmleditor.pro2
-rw-r--r--src/plugins/scxmleditor/scxmleditor.qbs1
-rw-r--r--src/plugins/scxmleditor/scxmleditordata.cpp5
-rw-r--r--src/plugins/scxmleditor/scxmleditordata.h1
10 files changed, 10 insertions, 112 deletions
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index c150404ccc..438e0b3c2e 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -98,12 +98,6 @@ private:
Qt::MouseButton m_mouseButtonPressed = Qt::NoButton;
};
-class TaskWindowContext : public Core::IContext
-{
-public:
- TaskWindowContext(QWidget *widget);
-};
-
class TaskDelegate : public QStyledItemDelegate
{
Q_OBJECT
@@ -289,7 +283,7 @@ public:
Internal::TaskModel *m_model;
Internal::TaskFilterModel *m_filter;
Internal::TaskView *m_listview;
- Internal::TaskWindowContext *m_taskWindowContext;
+ Core::IContext *m_taskWindowContext;
QMenu *m_contextMenu;
QMap<const QAction *, ITaskHandler *> m_actionToHandlerMap;
ITaskHandler *m_defaultHandler = nullptr;
@@ -329,8 +323,9 @@ TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
- d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview);
-
+ d->m_taskWindowContext = new Core::IContext(d->m_listview);
+ d->m_taskWindowContext->setWidget(d->m_listview);
+ d->m_taskWindowContext->setContext(Core::Context(Core::Constants::C_PROBLEM_PANE));
Core::ICore::addContextObject(d->m_taskWindowContext);
connect(d->m_listview->selectionModel(), &QItemSelectionModel::currentChanged,
@@ -1018,13 +1013,6 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->restore();
}
-TaskWindowContext::TaskWindowContext(QWidget *widget)
- : Core::IContext(widget)
-{
- setWidget(widget);
- setContext(Core::Context(Core::Constants::C_PROBLEM_PANE));
-}
-
} // namespace Internal
} // namespace ProjectExplorer
diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp
index fbc656e346..51c384e1d5 100644
--- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp
+++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp
@@ -41,8 +41,9 @@
namespace QmlDesigner {
BindingEditorWidget::BindingEditorWidget()
- : m_context(new BindingEditorContext(this))
+ : m_context(new Core::IContext(this))
{
+ m_context->setWidget(this);
Core::ICore::addContextObject(m_context);
const Core::Context context(BINDINGEDITOR_CONTEXT_ID);
diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.h b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.h
index 597051d89f..33b9d1830e 100644
--- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.h
+++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.h
@@ -39,18 +39,6 @@ namespace QmlDesigner {
const char BINDINGEDITOR_CONTEXT_ID[] = "BindingEditor.BindingEditorContext";
-
-class BindingEditorContext : public Core::IContext
-{
- Q_OBJECT
-
-public:
- BindingEditorContext(QWidget *parent) : Core::IContext(parent)
- {
- setWidget(parent);
- }
-};
-
class BindingEditorWidget : public QmlJSEditor::QmlJSEditorWidget
{
Q_OBJECT
@@ -71,7 +59,7 @@ signals:
public:
QmlJSEditor::QmlJSEditorDocument *qmljsdocument = nullptr;
- BindingEditorContext *m_context = nullptr;
+ Core::IContext *m_context = nullptr;
QAction *m_completionAction = nullptr;
};
diff --git a/src/plugins/scxmleditor/CMakeLists.txt b/src/plugins/scxmleditor/CMakeLists.txt
index 9a4925dfa2..b3d5f9e22e 100644
--- a/src/plugins/scxmleditor/CMakeLists.txt
+++ b/src/plugins/scxmleditor/CMakeLists.txt
@@ -82,7 +82,6 @@ add_qtc_plugin(ScxmlEditor
plugin_interface/utilsprovider.cpp plugin_interface/utilsprovider.h
plugin_interface/warningitem.cpp plugin_interface/warningitem.h
plugin_interface/warningprovider.h
- scxmlcontext.cpp scxmlcontext.h
scxmleditor_global.h
scxmleditorconstants.h
scxmleditordata.cpp scxmleditordata.h
diff --git a/src/plugins/scxmleditor/scxmlcontext.cpp b/src/plugins/scxmleditor/scxmlcontext.cpp
deleted file mode 100644
index 57b926da5b..0000000000
--- a/src/plugins/scxmleditor/scxmlcontext.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "scxmlcontext.h"
-
-using namespace ScxmlEditor::Internal;
-
-ScxmlContext::ScxmlContext(const Core::Context &context, QWidget *widget, QObject *parent)
- : Core::IContext(parent)
-{
- setContext(context);
- setWidget(widget);
-}
diff --git a/src/plugins/scxmleditor/scxmlcontext.h b/src/plugins/scxmleditor/scxmlcontext.h
deleted file mode 100644
index 0765ce37b1..0000000000
--- a/src/plugins/scxmleditor/scxmlcontext.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include <coreplugin/icontext.h>
-
-namespace ScxmlEditor {
-namespace Internal {
-
-class ScxmlContext : public Core::IContext
-{
-public:
- explicit ScxmlContext(const Core::Context &contexts, QWidget *widget, QObject *parent = nullptr);
-};
-
-} // namespace Internal
-} // namespace Designer
diff --git a/src/plugins/scxmleditor/scxmleditor.pro b/src/plugins/scxmleditor/scxmleditor.pro
index eb1788957e..1aac8b6277 100644
--- a/src/plugins/scxmleditor/scxmleditor.pro
+++ b/src/plugins/scxmleditor/scxmleditor.pro
@@ -3,7 +3,6 @@ include(../../qtcreatorplugin.pri)
INCLUDEPATH += $$PWD
HEADERS += \
- scxmlcontext.h \
scxmleditor_global.h \
scxmleditorconstants.h \
scxmleditordata.h \
@@ -14,7 +13,6 @@ HEADERS += \
scxmltexteditor.h
SOURCES += \
- scxmlcontext.cpp \
scxmleditordata.cpp \
scxmleditordocument.cpp \
scxmleditorfactory.cpp \
diff --git a/src/plugins/scxmleditor/scxmleditor.qbs b/src/plugins/scxmleditor/scxmleditor.qbs
index 2d32ed390c..2b30a29c5a 100644
--- a/src/plugins/scxmleditor/scxmleditor.qbs
+++ b/src/plugins/scxmleditor/scxmleditor.qbs
@@ -21,7 +21,6 @@ QtcPlugin {
])
files: [
- "scxmlcontext.cpp", "scxmlcontext.h",
"scxmleditor_global.h",
"scxmleditorconstants.h",
"scxmleditordata.cpp", "scxmleditordata.h",
diff --git a/src/plugins/scxmleditor/scxmleditordata.cpp b/src/plugins/scxmleditor/scxmleditordata.cpp
index 881c39af9a..01e39b22bb 100644
--- a/src/plugins/scxmleditor/scxmleditordata.cpp
+++ b/src/plugins/scxmleditor/scxmleditordata.cpp
@@ -25,7 +25,6 @@
#include "scxmleditordata.h"
#include "mainwidget.h"
-#include "scxmlcontext.h"
#include "scxmleditorconstants.h"
#include "scxmleditordocument.h"
#include "scxmleditorstack.h"
@@ -143,7 +142,9 @@ void ScxmlEditorData::fullInit()
Context scxmlContexts = m_contexts;
scxmlContexts.add(Core::Constants::C_EDITORMANAGER);
- auto context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
+ auto context = new IContext(this);
+ context->setContext(scxmlContexts);
+ context->setWidget(m_modeWidget);
ICore::addContextObject(context);
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
diff --git a/src/plugins/scxmleditor/scxmleditordata.h b/src/plugins/scxmleditor/scxmleditordata.h
index f495f2fbf5..ed36e3e323 100644
--- a/src/plugins/scxmleditor/scxmleditordata.h
+++ b/src/plugins/scxmleditor/scxmleditordata.h
@@ -40,7 +40,6 @@ namespace Internal {
class ScxmlTextEditorFactory;
class ScxmlEditorWidget;
class ScxmlEditorStack;
-class ScxmlContext;
class ScxmlEditorData : public QObject
{