summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-07-12 01:22:16 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-07-12 01:30:48 (GMT)
commit0fdf5122c72eb86d49cba2b69f80d3a9c5949da6 (patch)
tree2b3fd00bdbf1c890450350da4cb7e4935fffd584 /src
parentb4ceee6ee8f8bd45567c900be0b89dc13af57c3d (diff)
downloadQt-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')
-rw-r--r--src/declarative/QmlChanges.txt5
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp36
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h5
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 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);