forked from qt-creator/qt-creator
QmlJsEditor: Delay construction of QuickToolBar
It's now apparently created when the first .qml file opens. Change-Id: I4bcd84d29da268565ee6e771f8c56c8b07ecdaf3 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -116,7 +116,7 @@ void QmlJSEditorWidget::finalizeInitialization()
|
||||
this, &QmlJSEditorWidget::updateOutlineIndexNow);
|
||||
|
||||
m_modelManager = ModelManagerInterface::instance();
|
||||
m_contextPane = Internal::QmlJSEditorPlugin::quickToolBar();
|
||||
m_contextPane = QuickToolBar::instance();
|
||||
|
||||
m_modelManager->activateScan();
|
||||
|
||||
|
@@ -85,7 +85,6 @@ public:
|
||||
ICore::resourcePath("json/").toString()}};
|
||||
QmlJSEditorFactory m_qmlJSEditorFactory;
|
||||
QmlJSOutlineWidgetFactory m_qmlJSOutlineWidgetFactory;
|
||||
QuickToolBar m_quickToolBar;
|
||||
QmlJsEditingSettingsPage m_qmJSEditingSettingsPage;
|
||||
};
|
||||
|
||||
@@ -223,12 +222,6 @@ QmlJS::JsonSchemaManager *QmlJSEditorPlugin::jsonManager()
|
||||
return &m_instance->d->m_jsonManager;
|
||||
}
|
||||
|
||||
QuickToolBar *QmlJSEditorPlugin::quickToolBar()
|
||||
{
|
||||
QTC_ASSERT(m_instance && m_instance->d, return new QuickToolBar());
|
||||
return &m_instance->d->m_quickToolBar;
|
||||
}
|
||||
|
||||
void QmlJSEditorPluginPrivate::renameUsages()
|
||||
{
|
||||
if (auto editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget()))
|
||||
|
@@ -24,7 +24,6 @@ public:
|
||||
|
||||
static QmlJSQuickFixAssistProvider *quickFixAssistProvider();
|
||||
static QmlJS::JsonSchemaManager *jsonManager();
|
||||
static QuickToolBar *quickToolBar();
|
||||
|
||||
private:
|
||||
void initialize() final;
|
||||
|
@@ -86,6 +86,12 @@ QuickToolBar::~QuickToolBar()
|
||||
m_widget = nullptr;
|
||||
}
|
||||
|
||||
QuickToolBar *QuickToolBar::instance()
|
||||
{
|
||||
static QuickToolBar theQuickToolBar;
|
||||
return &theQuickToolBar;
|
||||
}
|
||||
|
||||
void QuickToolBar::apply(TextEditor::TextEditorWidget *editorWidget, Document::Ptr document, const ScopeChain *scopeChain, Node *node, bool update, bool force)
|
||||
{
|
||||
if (!QmlJsEditingSettings::get().enableContextPane() && !force && !update) {
|
||||
|
@@ -15,9 +15,12 @@ class QuickToolBar : public QmlJS::IContextPane
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuickToolBar();
|
||||
public:
|
||||
~QuickToolBar() override;
|
||||
|
||||
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 setProperty(const QString &propertyName, const QVariant &value);
|
||||
|
Reference in New Issue
Block a user