From d3bea65eae71a21a7b9893317c4dbafba20f17c8 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 18 Nov 2009 21:03:41 +0100 Subject: QLineEdit fix for mac On the Mac Up/Down arrow keys move the cursor to the beginning/end of the lineedit. The fix is to make sure the corresponding keyevent will be accepted by the QLineEdit and not propagated to parent widgets (resulting in a beep). Reviewed-by: Prasanth --- src/gui/widgets/qlinecontrol.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 300a2ea..9d533ae 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1666,6 +1666,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } #endif // QT_NO_SHORTCUT else { + bool handled = false; #ifdef Q_WS_MAC if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); @@ -1683,6 +1684,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) event->key() == Qt::Key_Up ? home(0) : end(0); } } + handled = true; } #endif if (event->modifiers() & Qt::ControlModifier) { @@ -1715,7 +1717,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event) break; #endif default: - unknown = true; + if (!handled) + unknown = true; } } else { // ### check for *no* modifier switch (event->key()) { @@ -1748,7 +1751,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event) #endif default: - unknown = true; + if (!handled) + unknown = true; } } } -- cgit v0.12