summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-10 02:04:18 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-10 02:04:18 (GMT)
commit6ab242e23832f0ab10ef26a3b7b505cf086ddf43 (patch)
tree1fcb69478827d8efb5379bbd2219185a908071e5 /src
parentb524e356424fe386eae56f65600077ce52ca6f92 (diff)
downloadQt-6ab242e23832f0ab10ef26a3b7b505cf086ddf43.zip
Qt-6ab242e23832f0ab10ef26a3b7b505cf086ddf43.tar.gz
Qt-6ab242e23832f0ab10ef26a3b7b505cf086ddf43.tar.bz2
Prevent handling of Up/Down on Mac OS X, for consistency with other platforms.
Task-number: QTBUG-10438
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 9ae4e1a..604f508 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE
Input constraints include setting a QValidator, an input mask, or a
maximum input length.
+
+ On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled.
+ If you want such bindings (on any platform), you will need to construct them in QML.
*/
QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent)
: QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
@@ -860,10 +863,12 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus)
void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
{
Q_D(QDeclarativeTextInput);
- if(((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
+ if (((ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier) // Don't allow MacOSX up/down support, and we don't allow a completer.
+ || (((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
|| (d->control->cursor() == d->control->text().length()
&& ev->key() == Qt::Key_Right))
- && (d->lastSelectionStart == d->lastSelectionEnd)){
+ && (d->lastSelectionStart == d->lastSelectionEnd)))
+ {
//ignore when moving off the end
//unless there is a selection, because then moving will do something (deselect)
ev->ignore();