diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-07-12 01:22:16 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-13 04:44:19 (GMT) |
commit | 35dc9919a0dadaafb72ab4651cc5e9ea29b9aa66 (patch) | |
tree | 94cf96d6b4bb5a633b901916fc269d6961b9e96c /src | |
parent | 957751d93aeb8d5c2703fa3d13d8b3a0e0334d51 (diff) | |
download | Qt-35dc9919a0dadaafb72ab4651cc5e9ea29b9aa66.zip Qt-35dc9919a0dadaafb72ab4651cc5e9ea29b9aa66.tar.gz Qt-35dc9919a0dadaafb72ab4651cc5e9ea29b9aa66.tar.bz2 |
Add copy(), cut() and paste() support to TextInput
Task-number: QTBUG-12086
Reviewed-by: Michael Brasser
(cherry picked from commit 0fdf5122c72eb86d49cba2b69f80d3a9c5949da6)
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/QmlChanges.txt | 5 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 36 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput_p.h | 5 |
3 files changed, 46 insertions, 0 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 259d9a9..872f6cb 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,4 +1,9 @@ ============================================================================= +The changes below are pre Qt 4.7.0 tech preview + +TextInput + - copy(), cut() and paste() functions added + The changes below are pre Qt 4.7.0 beta 2 QDeclarativeView diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index c2eea6e..2707b9c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1154,6 +1154,42 @@ void QDeclarativeTextInput::selectAll() d->control->setSelection(0, d->control->text().length()); } +#ifndef QT_NO_CLIPBOARD +/*! + \qmlmethod TextInput::cut() + + Moves the currently selected text to the system clipboard. +*/ +void QDeclarativeTextInput::cut() +{ + Q_D(QDeclarativeTextInput); + d->control->copy(); + d->control->del(); +} + +/*! + \qmlmethod TextInput::copy() + + Copies the currently selected text to the system clipboard. +*/ +void QDeclarativeTextInput::copy() +{ + Q_D(QDeclarativeTextInput); + d->control->copy(); +} + +/*! + \qmlmethod TextInput::paste() + + Replaces the currently selected text by the contents of the system clipboard. +*/ +void QDeclarativeTextInput::paste() +{ + Q_D(QDeclarativeTextInput); + d->control->paste(); +} +#endif // QT_NO_CLIPBOARD + /*! \qmlmethod void TextInput::selectWord() diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index bacd041..336a8b9 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -230,6 +230,11 @@ public Q_SLOTS: void selectAll(); void selectWord(); void select(int start, int end); +#ifndef QT_NO_CLIPBOARD + void cut(); + void copy(); + void paste(); +#endif private Q_SLOTS: void updateSize(bool needsRedraw = true); |