Emit cursorPositionChanged in private slot.
authorFrederik Gladhorn <frederik.gladhorn@digia.com>
Fri, 12 Oct 2012 16:42:21 +0000 (18:42 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 22 Oct 2012 06:42:16 +0000 (08:42 +0200)
Since the private slot is already there and used, it might as well
emit the signal and save us one connection.

Change-Id: I899df74c20f8c2b7875a0f9d0a04465c5dc48bde
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
src/widgets/widgets/qplaintextedit.cpp

index f27ca39..992e613 100644 (file)
@@ -442,11 +442,12 @@ QPlainTextEditControl::QPlainTextEditControl(QPlainTextEdit *parent)
 void QPlainTextEditPrivate::_q_cursorPositionChanged()
 {
     pageUpDownLastCursorYIsValid = false;
-#ifndef QT_NO_ACCESSIBILITY
     Q_Q(QPlainTextEdit);
+#ifndef QT_NO_ACCESSIBILITY
     QAccessibleTextCursorEvent ev(q, q->textCursor().position());
     QAccessible::updateAccessibility(&ev);
 #endif
+    emit q->cursorPositionChanged();
 }
 
 void QPlainTextEditPrivate::_q_verticalScrollbarActionTriggered(int action) {
@@ -778,7 +779,6 @@ void QPlainTextEditPrivate::init(const QString &txt)
     QObject::connect(control, SIGNAL(copyAvailable(bool)), q, SIGNAL(copyAvailable(bool)));
     QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
     QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
-    QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
 
     QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));