forked from qt-creator/qt-creator
QmlJSEditor: use direct member initialization
Change-Id: I03aada10107a9d80d920d18c92df7ec36e6a22d4 Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
@@ -105,10 +105,7 @@ namespace Internal {
|
|||||||
|
|
||||||
QmlJSEditorWidget::QmlJSEditorWidget()
|
QmlJSEditorWidget::QmlJSEditorWidget()
|
||||||
{
|
{
|
||||||
m_outlineCombo = 0;
|
|
||||||
m_contextPane = 0;
|
|
||||||
m_findReferences = new FindReferences(this);
|
m_findReferences = new FindReferences(this);
|
||||||
|
|
||||||
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +139,6 @@ void QmlJSEditorWidget::finalizeInitialization()
|
|||||||
&m_contextPaneTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
&m_contextPaneTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
||||||
connect(m_contextPane, &IContextPane::closed, this, &QmlJSEditorWidget::showTextMarker);
|
connect(m_contextPane, &IContextPane::closed, this, &QmlJSEditorWidget::showTextMarker);
|
||||||
}
|
}
|
||||||
m_oldCursorPosition = -1;
|
|
||||||
|
|
||||||
connect(this->document(), &QTextDocument::modificationChanged,
|
connect(this->document(), &QTextDocument::modificationChanged,
|
||||||
this, &QmlJSEditorWidget::modificationChanged);
|
this, &QmlJSEditorWidget::modificationChanged);
|
||||||
|
|||||||
@@ -117,16 +117,16 @@ private:
|
|||||||
QModelIndex indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex = QModelIndex()) const;
|
QModelIndex indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex = QModelIndex()) const;
|
||||||
bool hideContextPane();
|
bool hideContextPane();
|
||||||
|
|
||||||
QmlJSEditorDocument *m_qmlJsEditorDocument;
|
QmlJSEditorDocument *m_qmlJsEditorDocument = nullptr;
|
||||||
QTimer m_updateUsesTimer; // to wait for multiple text cursor position changes
|
QTimer m_updateUsesTimer; // to wait for multiple text cursor position changes
|
||||||
QTimer m_updateOutlineIndexTimer;
|
QTimer m_updateOutlineIndexTimer;
|
||||||
QTimer m_contextPaneTimer;
|
QTimer m_contextPaneTimer;
|
||||||
QComboBox *m_outlineCombo;
|
QComboBox *m_outlineCombo;
|
||||||
QModelIndex m_outlineModelIndex;
|
QModelIndex m_outlineModelIndex;
|
||||||
QmlJS::ModelManagerInterface *m_modelManager;
|
QmlJS::ModelManagerInterface *m_modelManager = nullptr;
|
||||||
|
|
||||||
QmlJS::IContextPane *m_contextPane;
|
QmlJS::IContextPane *m_contextPane = nullptr;
|
||||||
int m_oldCursorPosition;
|
int m_oldCursorPosition = -1;
|
||||||
|
|
||||||
FindReferences *m_findReferences;
|
FindReferences *m_findReferences;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -455,12 +455,9 @@ namespace QmlJSEditor {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *parent)
|
QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *parent)
|
||||||
: q(parent),
|
: q(parent)
|
||||||
m_semanticInfoDocRevision(-1),
|
, m_semanticHighlighter(new SemanticHighlighter(parent))
|
||||||
m_semanticHighlighter(new SemanticHighlighter(parent)),
|
, m_outlineModel(new QmlOutlineModel(parent))
|
||||||
m_semanticHighlightingNecessary(false),
|
|
||||||
m_outlineModelNeedsUpdate(false),
|
|
||||||
m_outlineModel(new QmlOutlineModel(parent))
|
|
||||||
{
|
{
|
||||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||||
|
|
||||||
|
|||||||
@@ -58,19 +58,19 @@ public:
|
|||||||
void updateOutlineModel();
|
void updateOutlineModel();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlJSEditorDocument *q;
|
QmlJSEditorDocument *q = nullptr;
|
||||||
QTimer m_updateDocumentTimer; // used to compress multiple document changes
|
QTimer m_updateDocumentTimer; // used to compress multiple document changes
|
||||||
QTimer m_reupdateSemanticInfoTimer; // used to compress multiple libraryInfo changes
|
QTimer m_reupdateSemanticInfoTimer; // used to compress multiple libraryInfo changes
|
||||||
int m_semanticInfoDocRevision; // document revision to which the semantic info is currently updated to
|
int m_semanticInfoDocRevision = -1; // document revision to which the semantic info is currently updated to
|
||||||
SemanticInfoUpdater *m_semanticInfoUpdater;
|
SemanticInfoUpdater *m_semanticInfoUpdater;
|
||||||
QmlJSTools::SemanticInfo m_semanticInfo;
|
QmlJSTools::SemanticInfo m_semanticInfo;
|
||||||
QVector<QTextLayout::FormatRange> m_diagnosticRanges;
|
QVector<QTextLayout::FormatRange> m_diagnosticRanges;
|
||||||
Internal::SemanticHighlighter *m_semanticHighlighter;
|
Internal::SemanticHighlighter *m_semanticHighlighter = nullptr;
|
||||||
bool m_semanticHighlightingNecessary;
|
bool m_semanticHighlightingNecessary = false;
|
||||||
bool m_outlineModelNeedsUpdate;
|
bool m_outlineModelNeedsUpdate = false;
|
||||||
bool m_firstSementicInfo = true;
|
bool m_firstSementicInfo = true;
|
||||||
QTimer m_updateOutlineModelTimer;
|
QTimer m_updateOutlineModelTimer;
|
||||||
Internal::QmlOutlineModel *m_outlineModel;
|
Internal::QmlOutlineModel *m_outlineModel = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -94,13 +94,10 @@ void QmlJSOutlineFilterModel::setFilterBindings(bool filterBindings)
|
|||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) :
|
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_blockCursorSync(false)
|
|
||||||
{
|
{
|
||||||
m_filterModel->setFilterBindings(false);
|
m_filterModel->setFilterBindings(false);
|
||||||
|
|
||||||
|
|||||||
@@ -85,14 +85,14 @@ private:
|
|||||||
bool syncCursor();
|
bool syncCursor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QmlJSOutlineTreeView *m_treeView;
|
QmlJSOutlineTreeView *m_treeView = nullptr;
|
||||||
QmlJSOutlineFilterModel *m_filterModel;
|
QmlJSOutlineFilterModel *m_filterModel = nullptr;
|
||||||
QmlJSEditorWidget *m_editor;
|
QmlJSEditorWidget *m_editor = nullptr;
|
||||||
|
|
||||||
QAction *m_showBindingsAction;
|
QAction *m_showBindingsAction = nullptr;
|
||||||
|
|
||||||
bool m_enableCursorSync;
|
bool m_enableCursorSync = true;
|
||||||
bool m_blockCursorSync;
|
bool m_blockCursorSync = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QmlJSOutlineWidgetFactory : public TextEditor::IOutlineWidgetFactory
|
class QmlJSOutlineWidgetFactory : public TextEditor::IOutlineWidgetFactory
|
||||||
|
|||||||
Reference in New Issue
Block a user