diff options
author | hjk <qthjk@ovi.com> | 2012-08-28 09:33:09 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-02 10:09:28 +0200 |
commit | 9d4814e18b9c243340f492f8b7ddd19b523b229f (patch) | |
tree | 219180a1d028ddc83861455dd31dbfefa33b64bc /src/widgets/widgets/qtextedit.cpp | |
parent | e0ce39ea675bd1395618207d14089a234c9dd3c8 (diff) |
Introduce hook for text cursor changes in QTextEdit and QPlainTextEdit
Currently it is hard for Q{Plain}TextEdit subclasses to keep track
of changes of the text cursor by direct calls to setTextCursor from
arbitrary code. By redirecting the setTextCursor to a virtual
function subclasses get the chance to intercept such calls.
Change-Id: Id92d9c86928b97285b0f5b7b39790442dfac3e50
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qtextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qtextedit.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 0ab76db5d3..0b31c536ac 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -757,6 +757,17 @@ QTextDocument *QTextEdit::document() const */ void QTextEdit::setTextCursor(const QTextCursor &cursor) { + doSetTextCursor(cursor); +} + +/*! + \internal + + This provides a hook for subclasses to intercept cursor changes. +*/ + +void QTextEdit::doSetTextCursor(const QTextCursor &cursor) +{ Q_D(QTextEdit); d->control->setTextCursor(cursor); } |