forked from qt-creator/qt-creator
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 <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -30,11 +30,11 @@
|
|||||||
|
|
||||||
#include "cppeditoroutline.h"
|
#include "cppeditoroutline.h"
|
||||||
|
|
||||||
#include "cppeditor.h"
|
|
||||||
#include "cppeditorplugin.h"
|
#include "cppeditorplugin.h"
|
||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <cpptools/cpptoolsreuse.h>
|
#include <cpptools/cpptoolsreuse.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include <cplusplus/OverviewModel.h>
|
#include <cplusplus/OverviewModel.h>
|
||||||
#include <utils/treeviewcombobox.h>
|
#include <utils/treeviewcombobox.h>
|
||||||
@@ -44,14 +44,12 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class CppEditor::Internal::CppEditorOutline
|
\class CppEditor::Internal::CppEditorOutline
|
||||||
\brief A helper class of CppEditorWidget that provides the outline model
|
\brief A helper class that provides the outline model and widget,
|
||||||
and widget, e.g. for the editor's tool bar.
|
e.g. for the editor's tool bar.
|
||||||
|
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
The caller is responsible for deleting the widget returned by widget().
|
The caller is responsible for deleting the widget returned by widget().
|
||||||
|
|
||||||
\sa CppEditor::Internal::CppEditorWidget
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum { UpdateOutlineIntervalInMs = 500 };
|
enum { UpdateOutlineIntervalInMs = 500 };
|
||||||
@@ -98,7 +96,7 @@ QTimer *newSingleShotTimer(QObject *parent, int msInternal, const QString &objec
|
|||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CppEditorOutline::CppEditorOutline(CppEditorWidget *editorWidget)
|
CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget)
|
||||||
: QObject(editorWidget)
|
: QObject(editorWidget)
|
||||||
, m_editorWidget(editorWidget)
|
, m_editorWidget(editorWidget)
|
||||||
, m_combo(new Utils::TreeViewComboBox)
|
, m_combo(new Utils::TreeViewComboBox)
|
||||||
|
@@ -41,20 +41,19 @@ class QTimer;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace CPlusPlus { class OverviewModel; }
|
namespace CPlusPlus { class OverviewModel; }
|
||||||
|
namespace TextEditor { class TextEditorWidget; }
|
||||||
namespace Utils { class TreeViewComboBox; }
|
namespace Utils { class TreeViewComboBox; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppEditorWidget;
|
|
||||||
|
|
||||||
class CppEditorOutline : public QObject
|
class CppEditorOutline : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(CppEditorOutline)
|
Q_DISABLE_COPY(CppEditorOutline)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CppEditorOutline(CppEditorWidget *editorWidget);
|
explicit CppEditorOutline(TextEditor::TextEditorWidget *editorWidget);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
@@ -84,7 +83,7 @@ private:
|
|||||||
const QModelIndex &rootIndex = QModelIndex()) const;
|
const QModelIndex &rootIndex = QModelIndex()) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CppEditorWidget *m_editorWidget;
|
TextEditor::TextEditorWidget *m_editorWidget;
|
||||||
|
|
||||||
Utils::TreeViewComboBox *m_combo; // Not owned
|
Utils::TreeViewComboBox *m_combo; // Not owned
|
||||||
CPlusPlus::OverviewModel *m_model;
|
CPlusPlus::OverviewModel *m_model;
|
||||||
|
Reference in New Issue
Block a user