QmlOutlineModel: Use document instead of widget

Change-Id: I56c4a1da84d00064334a235aec8f2710efdba365
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Eike Ziller
2014-01-30 16:10:23 +01:00
parent 9fcd43ed05
commit 1e6bc2758d
3 changed files with 7 additions and 7 deletions

View File

@@ -114,7 +114,7 @@ void QmlJSTextEditorWidget::ctor()
{ {
m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(baseTextDocument()); m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(baseTextDocument());
m_outlineCombo = 0; m_outlineCombo = 0;
m_outlineModel = new QmlOutlineModel(this); m_outlineModel = new QmlOutlineModel(m_qmlJsEditorDocument);
m_contextPane = 0; m_contextPane = 0;
m_findReferences = new FindReferences(this); m_findReferences = new FindReferences(this);

View File

@@ -298,9 +298,9 @@ private:
int indent; int indent;
}; };
QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) : QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *editor) :
QStandardItemModel(editor), QStandardItemModel(editor),
m_textEditor(editor) m_editorDocument(editor)
{ {
m_icons = Icons::instance(); m_icons = Icons::instance();
const QString resourcePath = Core::ICore::resourcePath(); 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 // only allow drag&drop if we're in sync
if (m_semanticInfo.isValid() if (m_semanticInfo.isValid()
&& !m_textEditor->isSemanticInfoOutdated()) { && !m_editorDocument->isSemanticInfoOutdated()) {
if (index.parent().isValid()) if (index.parent().isValid())
flags |= Qt::ItemIsDragEnabled; flags |= Qt::ItemIsDragEnabled;
if (index.data(ItemTypeRole) != NonElementBindingType) if (index.data(ItemTypeRole) != NonElementBindingType)

View File

@@ -30,7 +30,7 @@
#ifndef QMLOUTLINEMODEL_H #ifndef QMLOUTLINEMODEL_H
#define QMLOUTLINEMODEL_H #define QMLOUTLINEMODEL_H
#include "qmljseditor.h" #include "qmljseditordocument.h"
#include <utils/changeset.h> #include <utils/changeset.h>
#include <qmljs/qmljsdocument.h> #include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsicons.h> #include <qmljs/qmljsicons.h>
@@ -81,7 +81,7 @@ public:
NonElementBindingType // can be filtered out NonElementBindingType // can be filtered out
}; };
QmlOutlineModel(QmlJSTextEditorWidget *editor); QmlOutlineModel(QmlJSEditorDocument *editor);
// QStandardItemModel // QStandardItemModel
QStringList mimeTypes() const; QStringList mimeTypes() const;
@@ -159,7 +159,7 @@ private:
QHash<QmlOutlineItem*,QIcon> m_itemToIcon; QHash<QmlOutlineItem*,QIcon> m_itemToIcon;
QHash<QmlOutlineItem*,QmlJS::AST::Node*> m_itemToNode; QHash<QmlOutlineItem*,QmlJS::AST::Node*> m_itemToNode;
QHash<QmlOutlineItem*,QmlJS::AST::UiQualifiedId*> m_itemToIdNode; QHash<QmlOutlineItem*,QmlJS::AST::UiQualifiedId*> m_itemToIdNode;
QmlJSTextEditorWidget *m_textEditor; QmlJSEditorDocument *m_editorDocument;
friend class QmlOutlineModelSync; friend class QmlOutlineModelSync;