forked from qt-creator/qt-creator
QmlJSEditor: Fix crash when triggering context menu
Regression introduced with 3da9c89981.
Change-Id: Ia0ede1b46b7bc8cbce8b55335b3a548e7f8d384d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -35,10 +35,10 @@
|
|||||||
#include "qmljshoverhandler.h"
|
#include "qmljshoverhandler.h"
|
||||||
#include "qmljsquickfixassist.h"
|
#include "qmljsquickfixassist.h"
|
||||||
#include "qmloutlinemodel.h"
|
#include "qmloutlinemodel.h"
|
||||||
|
#include "quicktoolbar.h"
|
||||||
|
|
||||||
#include <qmljs/qmljsbind.h>
|
#include <qmljs/qmljsbind.h>
|
||||||
#include <qmljs/qmljsevaluate.h>
|
#include <qmljs/qmljsevaluate.h>
|
||||||
#include <qmljs/qmljsicontextpane.h>
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
#include <qmljs/qmljsutils.h>
|
#include <qmljs/qmljsutils.h>
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ void QmlJSEditorWidget::finalizeInitialization()
|
|||||||
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||||
|
|
||||||
m_modelManager = ModelManagerInterface::instance();
|
m_modelManager = ModelManagerInterface::instance();
|
||||||
m_contextPane = ExtensionSystem::PluginManager::getObject<IContextPane>();
|
m_contextPane = QmlJSEditorPlugin::quickToolBar();
|
||||||
|
|
||||||
m_modelManager->activateScan();
|
m_modelManager->activateScan();
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
class ModelManagerInterface;
|
class ModelManagerInterface;
|
||||||
class IContextPane;
|
|
||||||
namespace AST { class UiObjectMember; }
|
namespace AST { class UiObjectMember; }
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
|
|
||||||
class QmlJSEditorDocument;
|
class QmlJSEditorDocument;
|
||||||
|
class QuickToolBar;
|
||||||
class FindReferences;
|
class FindReferences;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -124,7 +124,7 @@ private:
|
|||||||
QModelIndex m_outlineModelIndex;
|
QModelIndex m_outlineModelIndex;
|
||||||
QmlJS::ModelManagerInterface *m_modelManager = nullptr;
|
QmlJS::ModelManagerInterface *m_modelManager = nullptr;
|
||||||
|
|
||||||
QmlJS::IContextPane *m_contextPane = nullptr;
|
QuickToolBar *m_contextPane = nullptr;
|
||||||
int m_oldCursorPosition = -1;
|
int m_oldCursorPosition = -1;
|
||||||
|
|
||||||
FindReferences *m_findReferences;
|
FindReferences *m_findReferences;
|
||||||
|
|||||||
@@ -238,6 +238,12 @@ Utils::JsonSchemaManager *QmlJSEditorPlugin::jsonManager()
|
|||||||
return &m_instance->d->m_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::findUsages()
|
void QmlJSEditorPluginPrivate::findUsages()
|
||||||
{
|
{
|
||||||
if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget()))
|
if (QmlJSEditorWidget *editor = qobject_cast<QmlJSEditorWidget*>(EditorManager::currentEditor()->widget()))
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
namespace Utils { class JsonSchemaManager; }
|
namespace Utils { class JsonSchemaManager; }
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
|
class QuickToolBar;
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlJSQuickFixAssistProvider;
|
class QmlJSQuickFixAssistProvider;
|
||||||
@@ -45,6 +46,7 @@ public:
|
|||||||
|
|
||||||
static QmlJSQuickFixAssistProvider *quickFixAssistProvider();
|
static QmlJSQuickFixAssistProvider *quickFixAssistProvider();
|
||||||
static Utils::JsonSchemaManager *jsonManager();
|
static Utils::JsonSchemaManager *jsonManager();
|
||||||
|
static QuickToolBar *quickToolBar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||||
|
|||||||
Reference in New Issue
Block a user