diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-07-12 01:22:16 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-07-12 01:30:48 (GMT) |
commit | 0fdf5122c72eb86d49cba2b69f80d3a9c5949da6 (patch) | |
tree | 2b3fd00bdbf1c890450350da4cb7e4935fffd584 /src/declarative/graphicsitems | |
parent | b4ceee6ee8f8bd45567c900be0b89dc13af57c3d (diff) | |
download | Qt-0fdf5122c72eb86d49cba2b69f80d3a9c5949da6.zip Qt-0fdf5122c72eb86d49cba2b69f80d3a9c5949da6.tar.gz Qt-0fdf5122c72eb86d49cba2b69f80d3a9c5949da6.tar.bz2 |
Add copy(), cut() and paste() support to TextInput
Task-number: QTBUG-12086
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 36 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput_p.h | 5 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 5325f25..f6af1f4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1142,6 +1142,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 ded0d09..b1862c6 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -232,6 +232,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); |