From 83cb2069ead120e7777a13ef6b7c0a0b14052685 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 28 Feb 2016 22:43:42 +0100 Subject: QQuickText{Edit,Input}: Reset selection when becoming readOnly. When read only, controls may not be edited or altered, and indeed, a read-only control cannot acquire a selection (as it cannot be interacted with). Leaving an existing selection breaks that implication, so clear it when becoming read-only. [ChangeLog][QtQuick][TextEdit/TextInput] If a control has a selection, it is now cleared when becoming read-only. Task-number: QTBUG-51115 Change-Id: Ife43b97ee3d6b780f09a938868c3ccb2f1b6e6e7 Reviewed-by: Simon Hausmann --- src/quick/items/qquicktextinput.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/quick/items/qquicktextinput.cpp') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 7a86e1a323..4b816c41c3 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -679,8 +679,7 @@ void QQuickTextInput::setReadOnly(bool ro) setFlag(QQuickItem::ItemAcceptsInputMethod, !ro); #endif d->m_readOnly = ro; - if (!ro) - d->setCursorPosition(d->end()); + d->setCursorPosition(d->end()); #ifndef QT_NO_IM updateInputMethod(Qt::ImEnabled); #endif -- cgit v1.2.3 From 443ba99b1ef825e198fe1999c34ee44547135797 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 18 Feb 2016 13:18:33 +0200 Subject: Prevent cutting in non-Normal echoMode of TextInput Cutting the text in Password mode led to the text being deleted. Cut and copy operations should not be allowed when echoMode is set to a mode other than Normal. Task-number: QTBUG-51231 Change-Id: If75cdaedac7478ecc1a5126ad4a5ecbf32acd1ab Reviewed-by: Robin Burchell --- src/quick/items/qquicktextinput.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/quick/items/qquicktextinput.cpp') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index ba7142856b..ffc94dfd46 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1886,11 +1886,15 @@ bool QQuickTextInput::isRightToLeft(int start, int end) \qmlmethod QtQuick::TextInput::cut() Moves the currently selected text to the system clipboard. + + \note If the echo mode is set to a mode other than Normal then cut + will not work. This is to prevent using cut as a method of bypassing + password features of the line control. */ void QQuickTextInput::cut() { Q_D(QQuickTextInput); - if (!d->m_readOnly) { + if (!d->m_readOnly && d->m_echoMode == QQuickTextInput::Normal) { d->copy(); d->del(); } @@ -1900,6 +1904,10 @@ void QQuickTextInput::cut() \qmlmethod QtQuick::TextInput::copy() Copies the currently selected text to the system clipboard. + + \note If the echo mode is set to a mode other than Normal then copy + will not work. This is to prevent using copy as a method of bypassing + password features of the line control. */ void QQuickTextInput::copy() { @@ -4251,10 +4259,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) } } else if (event == QKeySequence::Cut) { - if (!m_readOnly) { - copy(); - del(); - } + q->cut(); } else if (event == QKeySequence::DeleteEndOfLine) { if (!m_readOnly) -- cgit v1.2.3 From 7d512482842b2570b345a32a725d0f28b4e74697 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 23 Mar 2016 13:23:21 +0100 Subject: V4: Allow some more functions to be inlined. Change-Id: If9d1f87fd7cf0b12d2827c4574109234be7e8ab8 Reviewed-by: Robin Burchell --- src/quick/items/qquicktextinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items/qquicktextinput.cpp') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 2b1141bea8..6551af4396 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -43,7 +43,7 @@ #include "qquicktextutil_p.h" #include - +#include #include #include -- cgit v1.2.3