QmlJSEditor: use direct member initialization

Change-Id: I03aada10107a9d80d920d18c92df7ec36e6a22d4
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
Tim Jenssen
2017-03-31 12:19:48 +02:00
parent cff6a97a9b
commit 99f2fc9b45
6 changed files with 23 additions and 33 deletions

View File

@@ -105,10 +105,7 @@ namespace Internal {
QmlJSEditorWidget::QmlJSEditorWidget()
{
m_outlineCombo = 0;
m_contextPane = 0;
m_findReferences = new FindReferences(this);
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
}
@@ -142,7 +139,6 @@ void QmlJSEditorWidget::finalizeInitialization()
&m_contextPaneTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(m_contextPane, &IContextPane::closed, this, &QmlJSEditorWidget::showTextMarker);
}
m_oldCursorPosition = -1;
connect(this->document(), &QTextDocument::modificationChanged,
this, &QmlJSEditorWidget::modificationChanged);

View File

@@ -117,16 +117,16 @@ private:
QModelIndex indexForPosition(unsigned cursorPosition, const QModelIndex &rootIndex = QModelIndex()) const;
bool hideContextPane();
QmlJSEditorDocument *m_qmlJsEditorDocument;
QmlJSEditorDocument *m_qmlJsEditorDocument = nullptr;
QTimer m_updateUsesTimer; // to wait for multiple text cursor position changes
QTimer m_updateOutlineIndexTimer;
QTimer m_contextPaneTimer;
QComboBox *m_outlineCombo;
QModelIndex m_outlineModelIndex;
QmlJS::ModelManagerInterface *m_modelManager;
QmlJS::ModelManagerInterface *m_modelManager = nullptr;
QmlJS::IContextPane *m_contextPane;
int m_oldCursorPosition;
QmlJS::IContextPane *m_contextPane = nullptr;
int m_oldCursorPosition = -1;
FindReferences *m_findReferences;
};

View File

@@ -455,12 +455,9 @@ namespace QmlJSEditor {
namespace Internal {
QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *parent)
: q(parent),
m_semanticInfoDocRevision(-1),
m_semanticHighlighter(new SemanticHighlighter(parent)),
m_semanticHighlightingNecessary(false),
m_outlineModelNeedsUpdate(false),
m_outlineModel(new QmlOutlineModel(parent))
: q(parent)
, m_semanticHighlighter(new SemanticHighlighter(parent))
, m_outlineModel(new QmlOutlineModel(parent))
{
ModelManagerInterface *modelManager = ModelManagerInterface::instance();

View File

@@ -58,19 +58,19 @@ public:
void updateOutlineModel();
public:
QmlJSEditorDocument *q;
QmlJSEditorDocument *q = nullptr;
QTimer m_updateDocumentTimer; // used to compress multiple document 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;
QmlJSTools::SemanticInfo m_semanticInfo;
QVector<QTextLayout::FormatRange> m_diagnosticRanges;
Internal::SemanticHighlighter *m_semanticHighlighter;
bool m_semanticHighlightingNecessary;
bool m_outlineModelNeedsUpdate;
Internal::SemanticHighlighter *m_semanticHighlighter = nullptr;
bool m_semanticHighlightingNecessary = false;
bool m_outlineModelNeedsUpdate = false;
bool m_firstSementicInfo = true;
QTimer m_updateOutlineModelTimer;
Internal::QmlOutlineModel *m_outlineModel;
Internal::QmlOutlineModel *m_outlineModel = nullptr;
};
} // Internal

View File

@@ -94,13 +94,10 @@ void QmlJSOutlineFilterModel::setFilterBindings(bool filterBindings)
invalidateFilter();
}
QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent) :
TextEditor::IOutlineWidget(parent),
m_treeView(new QmlJSOutlineTreeView(this)),
m_filterModel(new QmlJSOutlineFilterModel(this)),
m_editor(0),
m_enableCursorSync(true),
m_blockCursorSync(false)
QmlJSOutlineWidget::QmlJSOutlineWidget(QWidget *parent)
: TextEditor::IOutlineWidget(parent)
, m_treeView(new QmlJSOutlineTreeView(this))
, m_filterModel(new QmlJSOutlineFilterModel(this))
{
m_filterModel->setFilterBindings(false);

View File

@@ -85,14 +85,14 @@ private:
bool syncCursor();
private:
QmlJSOutlineTreeView *m_treeView;
QmlJSOutlineFilterModel *m_filterModel;
QmlJSEditorWidget *m_editor;
QmlJSOutlineTreeView *m_treeView = nullptr;
QmlJSOutlineFilterModel *m_filterModel = nullptr;
QmlJSEditorWidget *m_editor = nullptr;
QAction *m_showBindingsAction;
QAction *m_showBindingsAction = nullptr;
bool m_enableCursorSync;
bool m_blockCursorSync;
bool m_enableCursorSync = true;
bool m_blockCursorSync = false;
};
class QmlJSOutlineWidgetFactory : public TextEditor::IOutlineWidgetFactory