forked from qt-creator/qt-creator
QmlJSEditor: Remove unneeded indirection via qmljsicontextpane.h
Change-Id: I39989fdb697dc7078a01f9582b790ee91021e3ab Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -32,7 +32,6 @@ add_qtc_library(QmlJS
|
||||
qmljsevaluate.cpp qmljsevaluate.h
|
||||
qmljsfindexportedcpptypes.cpp qmljsfindexportedcpptypes.h
|
||||
qmljsicons.cpp qmljsicons.h
|
||||
qmljsicontextpane.h
|
||||
qmljsimportdependencies.cpp qmljsimportdependencies.h
|
||||
qmljsindenter.cpp qmljsindenter.h
|
||||
qmljsinterpreter.cpp qmljsinterpreter.h
|
||||
|
@@ -30,7 +30,6 @@ Project {
|
||||
"qmljsevaluate.cpp", "qmljsevaluate.h",
|
||||
"qmljsfindexportedcpptypes.cpp", "qmljsfindexportedcpptypes.h",
|
||||
"qmljsicons.cpp", "qmljsicons.h",
|
||||
"qmljsicontextpane.h",
|
||||
"qmljsimportdependencies.cpp", "qmljsimportdependencies.h",
|
||||
"qmljsindenter.cpp", "qmljsindenter.h",
|
||||
"qmljsinterpreter.cpp", "qmljsinterpreter.h",
|
||||
|
@@ -1,34 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "qmljs_global.h"
|
||||
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||
|
||||
namespace TextEditor { class TextEditorWidget; }
|
||||
|
||||
namespace QmlJS {
|
||||
|
||||
class ScopeChain;
|
||||
|
||||
class QMLJS_EXPORT IContextPane : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IContextPane(QObject *parent = nullptr) : QObject(parent) {}
|
||||
virtual ~IContextPane() {}
|
||||
virtual void apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, AST::Node *node, bool update, bool force = false) = 0;
|
||||
virtual void setEnabled(bool) = 0;
|
||||
virtual bool isAvailable(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, AST::Node *node) = 0;
|
||||
virtual QWidget* widget() = 0;
|
||||
signals:
|
||||
void closed();
|
||||
};
|
||||
|
||||
} // namespace QmlJS
|
@@ -126,7 +126,7 @@ void QmlJSEditorWidget::finalizeInitialization()
|
||||
if (m_contextPane) {
|
||||
connect(this, &QmlJSEditorWidget::cursorPositionChanged,
|
||||
&m_contextPaneTimer, QOverload<>::of(&QTimer::start));
|
||||
connect(m_contextPane, &IContextPane::closed, this, &QmlJSEditorWidget::showTextMarker);
|
||||
connect(m_contextPane, &QuickToolBar::closed, this, &QmlJSEditorWidget::showTextMarker);
|
||||
}
|
||||
|
||||
connect(this->document(), &QTextDocument::modificationChanged,
|
||||
|
@@ -337,13 +337,11 @@ void QuickToolBar::setEnabled(bool b)
|
||||
widget()->hide();
|
||||
}
|
||||
|
||||
|
||||
QWidget* QuickToolBar::widget()
|
||||
QWidget *QuickToolBar::widget()
|
||||
{
|
||||
return contextWidget();
|
||||
}
|
||||
|
||||
|
||||
void QuickToolBar::onPropertyChanged(const QString &name, const QVariant &value)
|
||||
{
|
||||
if (m_blockWriting)
|
||||
@@ -411,7 +409,7 @@ void QuickToolBar::indentLines(int startLine, int endLine)
|
||||
}
|
||||
}
|
||||
|
||||
ContextPaneWidget* QuickToolBar::contextWidget()
|
||||
ContextPaneWidget *QuickToolBar::contextWidget()
|
||||
{
|
||||
if (m_widget.isNull()) { //lazily recreate widget
|
||||
m_widget = new ContextPaneWidget;
|
||||
@@ -425,7 +423,8 @@ ContextPaneWidget* QuickToolBar::contextWidget()
|
||||
this, &QuickToolBar::onEnabledChanged);
|
||||
connect(m_widget.data(), &ContextPaneWidget::pinnedChanged,
|
||||
this, &QuickToolBar::onPinnedChanged);
|
||||
connect(m_widget.data(), &ContextPaneWidget::closed, this, &IContextPane::closed);
|
||||
connect(m_widget.data(), &ContextPaneWidget::closed,
|
||||
this, &QuickToolBar::closed);
|
||||
}
|
||||
return m_widget.data();
|
||||
}
|
||||
|
@@ -3,30 +3,35 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qmljs/qmljsicontextpane.h>
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
#include <qmljs/parser/qmljsastfwd_p.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
namespace TextEditor { class TextEditorWidget; }
|
||||
|
||||
namespace QmlJS { class ScopeChain; }
|
||||
|
||||
namespace QmlEditorWidgets { class ContextPaneWidget; }
|
||||
|
||||
namespace QmlJSEditor {
|
||||
|
||||
class QuickToolBar : public QmlJS::IContextPane
|
||||
class QuickToolBar : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QuickToolBar();
|
||||
public:
|
||||
~QuickToolBar() override;
|
||||
~QuickToolBar();
|
||||
|
||||
static QuickToolBar *instance();
|
||||
|
||||
void apply(TextEditor::TextEditorWidget *widget, QmlJS::Document::Ptr document, const QmlJS::ScopeChain *scopeChain, QmlJS::AST::Node *node, bool update, bool force = false) override;
|
||||
bool isAvailable(TextEditor::TextEditorWidget *widget, QmlJS::Document::Ptr document, QmlJS::AST::Node *node) override;
|
||||
void apply(TextEditor::TextEditorWidget *widget, QmlJS::Document::Ptr document, const QmlJS::ScopeChain *scopeChain, QmlJS::AST::Node *node, bool update, bool force = false);
|
||||
bool isAvailable(TextEditor::TextEditorWidget *widget, QmlJS::Document::Ptr document, QmlJS::AST::Node *node);
|
||||
void setProperty(const QString &propertyName, const QVariant &value);
|
||||
void removeProperty(const QString &propertyName);
|
||||
void setEnabled(bool) override;
|
||||
QWidget* widget() override;
|
||||
void setEnabled(bool);
|
||||
QWidget *widget();
|
||||
|
||||
void onPropertyChanged(const QString &, const QVariant &);
|
||||
void onPropertyRemoved(const QString &);
|
||||
@@ -34,6 +39,9 @@ public:
|
||||
void onPinnedChanged(bool);
|
||||
void onEnabledChanged(bool);
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
||||
private:
|
||||
void indentLines(int startLine, int endLine);
|
||||
|
||||
@@ -48,4 +56,4 @@ private:
|
||||
QString m_oldType;
|
||||
};
|
||||
|
||||
} //QmlDesigner
|
||||
} // QmlJSEditor
|
||||
|
Reference in New Issue
Block a user