From db57fa894896668b63e2bc6712502e72a41d3c7f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 23 Jan 2015 14:06:42 +0100 Subject: [PATCH] CppEditor: Make CppEditorOutline independent of CppEditorWidget This enables us to move CppEditorOutline easier to CppTools, from where it could be subclassed by the ClangCodeModel plugin. Note that there is still the dependency to cppeditorplugin.h (setting sortedOutline). Change-Id: Ie595fb19d58be1c4339498a2dce9b97097867490 Reviewed-by: Marco Bubke --- src/plugins/cppeditor/cppeditoroutline.cpp | 10 ++++------ src/plugins/cppeditor/cppeditoroutline.h | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/cppeditor/cppeditoroutline.cpp b/src/plugins/cppeditor/cppeditoroutline.cpp index cf0c654b2c9..6b4e27021a3 100644 --- a/src/plugins/cppeditor/cppeditoroutline.cpp +++ b/src/plugins/cppeditor/cppeditoroutline.cpp @@ -30,11 +30,11 @@ #include "cppeditoroutline.h" -#include "cppeditor.h" #include "cppeditorplugin.h" #include #include +#include #include #include @@ -44,14 +44,12 @@ /*! \class CppEditor::Internal::CppEditorOutline - \brief A helper class of CppEditorWidget that provides the outline model - and widget, e.g. for the editor's tool bar. + \brief A helper class that provides the outline model and widget, + e.g. for the editor's tool bar. \internal The caller is responsible for deleting the widget returned by widget(). - - \sa CppEditor::Internal::CppEditorWidget */ enum { UpdateOutlineIntervalInMs = 500 }; @@ -98,7 +96,7 @@ QTimer *newSingleShotTimer(QObject *parent, int msInternal, const QString &objec namespace CppEditor { namespace Internal { -CppEditorOutline::CppEditorOutline(CppEditorWidget *editorWidget) +CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget) : QObject(editorWidget) , m_editorWidget(editorWidget) , m_combo(new Utils::TreeViewComboBox) diff --git a/src/plugins/cppeditor/cppeditoroutline.h b/src/plugins/cppeditor/cppeditoroutline.h index 26d141520a3..19b268305f0 100644 --- a/src/plugins/cppeditor/cppeditoroutline.h +++ b/src/plugins/cppeditor/cppeditoroutline.h @@ -41,20 +41,19 @@ class QTimer; QT_END_NAMESPACE namespace CPlusPlus { class OverviewModel; } +namespace TextEditor { class TextEditorWidget; } namespace Utils { class TreeViewComboBox; } namespace CppEditor { namespace Internal { -class CppEditorWidget; - class CppEditorOutline : public QObject { Q_OBJECT Q_DISABLE_COPY(CppEditorOutline) public: - explicit CppEditorOutline(CppEditorWidget *editorWidget); + explicit CppEditorOutline(TextEditor::TextEditorWidget *editorWidget); void update(); @@ -84,7 +83,7 @@ private: const QModelIndex &rootIndex = QModelIndex()) const; private: - CppEditorWidget *m_editorWidget; + TextEditor::TextEditorWidget *m_editorWidget; Utils::TreeViewComboBox *m_combo; // Not owned CPlusPlus::OverviewModel *m_model;