diff options
author | José Millán Soto <fid@gpul.org> | 2012-01-20 11:35:15 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-06 03:53:42 (GMT) |
commit | 36202cf8fca822492615d418bd563a40bee4af08 (patch) | |
tree | 40a5db471e7835ed24bca02ebffb3c61aa4c27b8 /src/plugins/accessible/widgets | |
parent | 827f7db3d99c17e66ccccef578060a9feed66312 (diff) | |
download | Qt-36202cf8fca822492615d418bd563a40bee4af08.zip Qt-36202cf8fca822492615d418bd563a40bee4af08.tar.gz Qt-36202cf8fca822492615d418bd563a40bee4af08.tar.bz2 |
Make copy and cut methods work in QAccessibleTextEdit
Correct the implementation of cutText and copyText in QAccessibleTextEdit so
they use cut() and copy() methods of QTextEdit
Change-Id: I86a531ed7059b1a928cb8515c2743d4d8b596b36
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/plugins/accessible/widgets')
-rw-r--r-- | src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 91bdc02..61cbacf 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -1645,12 +1645,17 @@ static QTextCursor cursorForRange(QTextEdit *textEdit, int startOffset, int endO void QAccessibleTextEdit::copyText(int startOffset, int endOffset) { +#ifndef QT_NO_CLIPBOARD + QTextCursor previousCursor = textEdit()->textCursor(); QTextCursor cursor = cursorForRange(textEdit(), startOffset, endOffset); if (!cursor.hasSelection()) return; -// QApplication::clipboard()->setMimeData(new QTextEditMimeData(cursor.selection())); + textEdit()->setTextCursor(cursor); + textEdit()->copy(); + textEdit()->setTextCursor(previousCursor); +#endif } void QAccessibleTextEdit::deleteText(int startOffset, int endOffset) @@ -1670,13 +1675,15 @@ void QAccessibleTextEdit::insertText(int offset, const QString &text) void QAccessibleTextEdit::cutText(int startOffset, int endOffset) { +#ifndef QT_NO_CLIPBOARD QTextCursor cursor = cursorForRange(textEdit(), startOffset, endOffset); if (!cursor.hasSelection()) return; -// QApplication::clipboard()->setMimeData(new QTextEditMimeData(cursor.selection())); - cursor.removeSelectedText(); + textEdit()->setTextCursor(cursor); + textEdit()->cut(); +#endif } void QAccessibleTextEdit::pasteText(int offset) |