Commit 2d64eb84 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlOutline: Replace WeakPointer by normal one

parent 258a212d
...@@ -67,6 +67,7 @@ QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) : ...@@ -67,6 +67,7 @@ QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) :
TextEditor::IOutlineWidget(parent), TextEditor::IOutlineWidget(parent),
m_treeView(new QmlJSOutlineTreeView(this)), m_treeView(new QmlJSOutlineTreeView(this)),
m_filterModel(new QmlJSOutlineFilterModel(this)), m_filterModel(new QmlJSOutlineFilterModel(this)),
m_editor(0),
m_enableCursorSync(true), m_enableCursorSync(true),
m_blockCursorSync(false) m_blockCursorSync(false)
{ {
...@@ -93,15 +94,15 @@ void QmlJSOutlineWidget::setEditor(QmlJSTextEditor *editor) ...@@ -93,15 +94,15 @@ void QmlJSOutlineWidget::setEditor(QmlJSTextEditor *editor)
{ {
m_editor = editor; m_editor = editor;
m_filterModel->setSourceModel(m_editor.data()->outlineModel()); m_filterModel->setSourceModel(m_editor->outlineModel());
modelUpdated(); modelUpdated();
connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(updateSelectionInText(QItemSelection))); this, SLOT(updateSelectionInText(QItemSelection)));
connect(m_editor.data(), SIGNAL(outlineModelIndexChanged(QModelIndex)), connect(m_editor, SIGNAL(outlineModelIndexChanged(QModelIndex)),
this, SLOT(updateSelectionInTree(QModelIndex))); this, SLOT(updateSelectionInTree(QModelIndex)));
connect(m_editor.data()->outlineModel(), SIGNAL(updated()), connect(m_editor->outlineModel(), SIGNAL(updated()),
this, SLOT(modelUpdated())); this, SLOT(modelUpdated()));
} }
...@@ -116,7 +117,7 @@ void QmlJSOutlineWidget::setCursorSynchronization(bool syncWithCursor) ...@@ -116,7 +117,7 @@ void QmlJSOutlineWidget::setCursorSynchronization(bool syncWithCursor)
{ {
m_enableCursorSync = syncWithCursor; m_enableCursorSync = syncWithCursor;
if (m_enableCursorSync) if (m_enableCursorSync)
updateSelectionInTree(m_editor.data()->outlineModelIndex()); updateSelectionInTree(m_editor->outlineModelIndex());
} }
void QmlJSOutlineWidget::restoreSettings(int position) void QmlJSOutlineWidget::restoreSettings(int position)
...@@ -163,11 +164,11 @@ void QmlJSOutlineWidget::updateSelectionInText(const QItemSelection &selection) ...@@ -163,11 +164,11 @@ void QmlJSOutlineWidget::updateSelectionInText(const QItemSelection &selection)
editorManager->cutForwardNavigationHistory(); editorManager->cutForwardNavigationHistory();
editorManager->addCurrentPositionToNavigationHistory(); editorManager->addCurrentPositionToNavigationHistory();
QTextCursor textCursor = m_editor.data()->textCursor(); QTextCursor textCursor = m_editor->textCursor();
m_blockCursorSync = true; m_blockCursorSync = true;
textCursor.setPosition(location.offset); textCursor.setPosition(location.offset);
m_editor.data()->setTextCursor(textCursor); m_editor->setTextCursor(textCursor);
m_editor.data()->centerCursor(); m_editor->centerCursor();
m_blockCursorSync = false; m_blockCursorSync = false;
} }
} }
......
...@@ -62,7 +62,7 @@ private: ...@@ -62,7 +62,7 @@ private:
private: private:
QmlJSOutlineTreeView *m_treeView; QmlJSOutlineTreeView *m_treeView;
QmlJSOutlineFilterModel *m_filterModel; QmlJSOutlineFilterModel *m_filterModel;
QWeakPointer<QmlJSTextEditor> m_editor; QmlJSTextEditor *m_editor;
QAction *m_showBindingsAction; QAction *m_showBindingsAction;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment