From 6ede3b0138bed45f91dfa6b84b662b7f342b45a3 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 29 Jun 2012 17:20:16 +1000 Subject: [PATCH] Use the convential form for the selectedText notify signal name. Rename selectionChanged to selectedTextChanged to address an apparent difference to API between TextInput and TextEdit. Task-number: QTBUG-19732 Change-Id: Ibc589c8b43567cb8d2f8c13f7366e2859c7f09d7 Reviewed-by: Martin Jones --- src/quick/items/qquicktextedit.cpp | 2 +- src/quick/items/qquicktextedit_p.h | 4 ++-- tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 5206785..7222c17 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1750,7 +1750,7 @@ void QQuickTextEditPrivate::init() qmlobject_connect(control, QQuickTextControl, SIGNAL(updateRequest(QRectF)), q, QQuickTextEdit, SLOT(updateDocument())); qmlobject_connect(control, QQuickTextControl, SIGNAL(updateCursorRequest()), q, QQuickTextEdit, SLOT(updateCursor())); qmlobject_connect(control, QQuickTextControl, SIGNAL(textChanged()), q, QQuickTextEdit, SLOT(q_textChanged())); - qmlobject_connect(control, QQuickTextControl, SIGNAL(selectionChanged()), q, QQuickTextEdit, SIGNAL(selectionChanged())); + qmlobject_connect(control, QQuickTextControl, SIGNAL(selectionChanged()), q, QQuickTextEdit, SIGNAL(selectedTextChanged())); qmlobject_connect(control, QQuickTextControl, SIGNAL(selectionChanged()), q, QQuickTextEdit, SLOT(updateSelectionMarkers())); qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorPositionChanged()), q, QQuickTextEdit, SLOT(updateSelectionMarkers())); qmlobject_connect(control, QQuickTextControl, SIGNAL(cursorPositionChanged()), q, QQuickTextEdit, SIGNAL(cursorPositionChanged())); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index b19873c..2b02a4a 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -83,7 +83,7 @@ class Q_AUTOTEST_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(QQmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged) Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged) - Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged) + Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) Q_PROPERTY(bool activeFocusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY activeFocusOnPressChanged) Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection NOTIFY persistentSelectionChanged) Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged) @@ -240,7 +240,7 @@ Q_SIGNALS: void cursorRectangleChanged(); void selectionStartChanged(); void selectionEndChanged(); - void selectionChanged(); + void selectedTextChanged(); void colorChanged(const QColor &color); void selectionColorChanged(const QColor &color); void selectedTextColorChanged(const QColor &color); diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index f893385..50a660b 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -1365,7 +1365,7 @@ void tst_qquicktextedit::keySelection() QVERIFY(input != 0); QTRY_VERIFY(input->hasActiveFocus() == true); - QSignalSpy spy(input, SIGNAL(selectionChanged())); + QSignalSpy spy(input, SIGNAL(selectedTextChanged())); simulateKey(&canvas, Qt::Key_Right, Qt::ShiftModifier); QVERIFY(input->hasActiveFocus() == true); @@ -3511,7 +3511,7 @@ void tst_qquicktextedit::insert() textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); - QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged())); + QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged())); QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged())); QSignalSpy textSpy(textEdit, SIGNAL(textChanged())); @@ -3535,8 +3535,8 @@ void tst_qquicktextedit::insert() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QEXPECT_FAIL("into selection", "selectionChanged signal isn't emitted on edits within selection", Continue); - QEXPECT_FAIL("into reversed selection", "selectionChanged signal isn't emitted on edits within selection", Continue); + QEXPECT_FAIL("into selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue); + QEXPECT_FAIL("into reversed selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue); QCOMPARE(selectionSpy.count() > 0, selectionChanged); QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); QEXPECT_FAIL("into reversed selection", "selectionEndChanged signal not emitted", Continue); @@ -3756,7 +3756,7 @@ void tst_qquicktextedit::remove() textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); - QSignalSpy selectionSpy(textEdit, SIGNAL(selectionChanged())); + QSignalSpy selectionSpy(textEdit, SIGNAL(seletedTextChanged())); QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged())); QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged())); QSignalSpy textSpy(textEdit, SIGNAL(textChanged())); @@ -3779,8 +3779,8 @@ void tst_qquicktextedit::remove() QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition); - QEXPECT_FAIL("from selection", "selectionChanged signal isn't emitted on edits within selection", Continue); - QEXPECT_FAIL("from reversed selection", "selectionChanged signal isn't emitted on edits within selection", Continue); + QEXPECT_FAIL("from selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue); + QEXPECT_FAIL("from reversed selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue); QCOMPARE(selectionSpy.count() > 0, selectionChanged); QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); QEXPECT_FAIL("from reversed selection", "selectionEndChanged signal not emitted", Continue); -- 2.7.4