forked from qt-creator/qt-creator
QmlOutlineModel: Use document instead of widget
Change-Id: I56c4a1da84d00064334a235aec8f2710efdba365 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -114,7 +114,7 @@ void QmlJSTextEditorWidget::ctor()
|
||||
{
|
||||
m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(baseTextDocument());
|
||||
m_outlineCombo = 0;
|
||||
m_outlineModel = new QmlOutlineModel(this);
|
||||
m_outlineModel = new QmlOutlineModel(m_qmlJsEditorDocument);
|
||||
m_contextPane = 0;
|
||||
m_findReferences = new FindReferences(this);
|
||||
|
||||
|
||||
@@ -298,9 +298,9 @@ private:
|
||||
int indent;
|
||||
};
|
||||
|
||||
QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) :
|
||||
QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *editor) :
|
||||
QStandardItemModel(editor),
|
||||
m_textEditor(editor)
|
||||
m_editorDocument(editor)
|
||||
{
|
||||
m_icons = Icons::instance();
|
||||
const QString resourcePath = Core::ICore::resourcePath();
|
||||
@@ -401,7 +401,7 @@ Qt::ItemFlags QmlOutlineModel::flags(const QModelIndex &index) const
|
||||
|
||||
// only allow drag&drop if we're in sync
|
||||
if (m_semanticInfo.isValid()
|
||||
&& !m_textEditor->isSemanticInfoOutdated()) {
|
||||
&& !m_editorDocument->isSemanticInfoOutdated()) {
|
||||
if (index.parent().isValid())
|
||||
flags |= Qt::ItemIsDragEnabled;
|
||||
if (index.data(ItemTypeRole) != NonElementBindingType)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef QMLOUTLINEMODEL_H
|
||||
#define QMLOUTLINEMODEL_H
|
||||
|
||||
#include "qmljseditor.h"
|
||||
#include "qmljseditordocument.h"
|
||||
#include <utils/changeset.h>
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
#include <qmljs/qmljsicons.h>
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
NonElementBindingType // can be filtered out
|
||||
};
|
||||
|
||||
QmlOutlineModel(QmlJSTextEditorWidget *editor);
|
||||
QmlOutlineModel(QmlJSEditorDocument *editor);
|
||||
|
||||
// QStandardItemModel
|
||||
QStringList mimeTypes() const;
|
||||
@@ -159,7 +159,7 @@ private:
|
||||
QHash<QmlOutlineItem*,QIcon> m_itemToIcon;
|
||||
QHash<QmlOutlineItem*,QmlJS::AST::Node*> m_itemToNode;
|
||||
QHash<QmlOutlineItem*,QmlJS::AST::UiQualifiedId*> m_itemToIdNode;
|
||||
QmlJSTextEditorWidget *m_textEditor;
|
||||
QmlJSEditorDocument *m_editorDocument;
|
||||
|
||||
|
||||
friend class QmlOutlineModelSync;
|
||||
|
||||
Reference in New Issue
Block a user