TextEditor: Further *Editor/*EditorWidget disentangling

In most cases, the *Editor constructor does not need to
access the *EditorWidget.

Change-Id: I1f5c076a0f723d5d82b398e8c250c7bd1d47eb17
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-19 00:54:45 +02:00
parent d2ec7d80d9
commit c5fae0e8da
34 changed files with 77 additions and 99 deletions

View File

@@ -98,7 +98,6 @@ namespace QmlJSEditor {
namespace Internal {
QmlJSTextEditorWidget::QmlJSTextEditorWidget(TextEditor::BaseTextDocumentPtr doc)
: TextEditor::BaseTextEditorWidget(0)
{
setTextDocument(doc);
@@ -151,6 +150,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(TextEditor::BaseTextDocumentPtr doc
SLOT(onRefactorMarkerClicked(TextEditor::RefactorMarker)));
setRequestMarkEnabled(true);
createToolBar();
}
QmlJSTextEditorWidget::~QmlJSTextEditorWidget()
@@ -529,12 +529,10 @@ bool QmlJSTextEditorWidget::isClosingBrace(const QList<Token> &tokens) const
TextEditor::BaseTextEditor *QmlJSTextEditorWidget::createEditor()
{
QmlJSEditor *editable = new QmlJSEditor(this);
createToolBar(editable);
return editable;
return new QmlJSEditor;
}
void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
void QmlJSTextEditorWidget::createToolBar()
{
m_outlineCombo = new QComboBox;
m_outlineCombo->setMinimumContentsLength(22);
@@ -568,7 +566,7 @@ void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
editor->editorWidget()->insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, m_outlineCombo);
}
TextEditor::BaseTextEditorWidget::Link QmlJSTextEditorWidget::findLinkAt(const QTextCursor &cursor,

View File

@@ -116,7 +116,7 @@ protected:
void scrollContentsBy(int dx, int dy);
void applyFontSettings();
TextEditor::BaseTextEditor *createEditor();
void createToolBar(QmlJSEditor *editable);
void createToolBar();
TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor,
bool resolveTarget = true,
bool inNextSplit = false);

View File

@@ -48,8 +48,7 @@
namespace QmlJSEditor {
namespace Internal {
QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
: BaseTextEditor(editor)
QmlJSEditor::QmlJSEditor()
{
m_context.add(Constants::C_QMLJSEDITOR_ID);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);

View File

@@ -44,7 +44,7 @@ class QmlJSEditor : public TextEditor::BaseTextEditor
Q_OBJECT
public:
explicit QmlJSEditor(QmlJSTextEditorWidget *);
QmlJSEditor();
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);