summaryrefslogtreecommitdiff
path: root/src/plugins/qmljseditor
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-08-26 17:15:37 +0200
committerhjk <hjk121@nokiamail.com>2014-08-27 16:08:02 +0200
commit2567f44a1d78435cf12a477677337a57f96cc13b (patch)
treebbefe8469d63462d889b03cfe7b18c860c997895 /src/plugins/qmljseditor
parent976d8bb8fb4aadba574b130963d1c39ce6f0ce71 (diff)
downloadqt-creator-2567f44a1d78435cf12a477677337a57f96cc13b.tar.gz
QmlJSEditor: some Qt5-ification
Change-Id: I494ec29e0e9c09192f30c80945725276cc03b531 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp41
-rw-r--r--src/plugins/qmljseditor/qmljseditor.h8
2 files changed, 26 insertions, 23 deletions
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 31e1f1cadf..179b59d1d6 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -122,16 +122,16 @@ void QmlJSEditorWidget::finalizeInitialization()
{
m_qmlJsEditorDocument = static_cast<QmlJSEditorDocument *>(textDocument());
- m_updateUsesTimer = new QTimer(this);
- m_updateUsesTimer->setInterval(UPDATE_USES_DEFAULT_INTERVAL);
- m_updateUsesTimer->setSingleShot(true);
- connect(m_updateUsesTimer, SIGNAL(timeout()), this, SLOT(updateUses()));
- connect(this, SIGNAL(cursorPositionChanged()), m_updateUsesTimer, SLOT(start()));
+ m_updateUsesTimer.setInterval(UPDATE_USES_DEFAULT_INTERVAL);
+ m_updateUsesTimer.setSingleShot(true);
+ connect(&m_updateUsesTimer, &QTimer::timeout, this, &QmlJSEditorWidget::updateUses);
+ connect(this, &QPlainTextEdit::cursorPositionChanged,
+ &m_updateUsesTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
- m_updateOutlineIndexTimer = new QTimer(this);
- m_updateOutlineIndexTimer->setInterval(UPDATE_OUTLINE_INTERVAL);
- m_updateOutlineIndexTimer->setSingleShot(true);
- connect(m_updateOutlineIndexTimer, SIGNAL(timeout()), this, SLOT(updateOutlineIndexNow()));
+ m_updateOutlineIndexTimer.setInterval(UPDATE_OUTLINE_INTERVAL);
+ m_updateOutlineIndexTimer.setSingleShot(true);
+ connect(&m_updateOutlineIndexTimer, &QTimer::timeout,
+ this, &QmlJSEditorWidget::updateOutlineIndexNow);
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
@@ -140,20 +140,22 @@ void QmlJSEditorWidget::finalizeInitialization()
m_modelManager->activateScan();
- m_contextPaneTimer = new QTimer(this);
- m_contextPaneTimer->setInterval(UPDATE_OUTLINE_INTERVAL);
- m_contextPaneTimer->setSingleShot(true);
- connect(m_contextPaneTimer, SIGNAL(timeout()), this, SLOT(updateContextPane()));
+ m_contextPaneTimer.setInterval(UPDATE_OUTLINE_INTERVAL);
+ m_contextPaneTimer.setSingleShot(true);
+ connect(&m_contextPaneTimer, &QTimer::timeout, this, &QmlJSEditorWidget::updateContextPane);
if (m_contextPane) {
- connect(this, SIGNAL(cursorPositionChanged()), m_contextPaneTimer, SLOT(start()));
- connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker()));
+ connect(this, &QmlJSEditorWidget::cursorPositionChanged,
+ &m_contextPaneTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
+ connect(m_contextPane, &IContextPane::closed, this, &QmlJSEditorWidget::showTextMarker);
}
m_oldCursorPosition = -1;
- connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool)));
+ connect(this->document(), &QTextDocument::modificationChanged,
+ this, &QmlJSEditorWidget::modificationChanged);
connect(m_qmlJsEditorDocument, SIGNAL(updateCodeWarnings(QmlJS::Document::Ptr)),
this, SLOT(updateCodeWarnings(QmlJS::Document::Ptr)));
+
connect(m_qmlJsEditorDocument, SIGNAL(semanticInfoUpdated(QmlJSTools::SemanticInfo)),
this, SLOT(semanticInfoUpdated(QmlJSTools::SemanticInfo)));
@@ -257,7 +259,7 @@ void QmlJSEditorWidget::updateOutlineIndexNow()
return;
if (m_qmlJsEditorDocument->outlineModel()->document()->editorRevision() != document()->revision()) {
- m_updateOutlineIndexTimer->start();
+ m_updateOutlineIndexTimer.start();
return;
}
@@ -561,7 +563,8 @@ void QmlJSEditorWidget::createToolBar()
connect(m_qmlJsEditorDocument->outlineModel(), SIGNAL(updated()),
this, SLOT(updateOutlineIndexNow()));
- connect(this, SIGNAL(cursorPositionChanged()), m_updateOutlineIndexTimer, SLOT(start()));
+ connect(this, &QmlJSEditorWidget::cursorPositionChanged,
+ &m_updateOutlineIndexTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
insertExtraToolBarWidget(BaseTextEditorWidget::Left, m_outlineCombo);
}
@@ -795,7 +798,7 @@ void QmlJSEditorWidget::semanticInfoUpdated(const SemanticInfo &semanticInfo)
Node *newNode = semanticInfo.declaringMemberNoProperties(position());
if (newNode) {
m_contextPane->apply(editor(), semanticInfo.document, 0, newNode, true);
- m_contextPaneTimer->start(); //update text marker
+ m_contextPaneTimer.start(); //update text marker
}
}
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index 118cb1bc77..aed1159aaa 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -40,10 +40,10 @@
#include <utils/uncommentselection.h>
#include <QModelIndex>
+#include <QTimer>
QT_BEGIN_NAMESPACE
class QComboBox;
-class QTimer;
QT_END_NAMESPACE
namespace QmlJS {
@@ -123,9 +123,9 @@ private:
bool hideContextPane();
QmlJSEditorDocument *m_qmlJsEditorDocument;
- QTimer *m_updateUsesTimer; // to wait for multiple text cursor position changes
- QTimer *m_updateOutlineIndexTimer;
- QTimer *m_contextPaneTimer;
+ 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;