summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-18 20:03:41 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-24 12:20:24 (GMT)
commitd3bea65eae71a21a7b9893317c4dbafba20f17c8 (patch)
treec6e0358dcc797cdaf02df04386fbcd0aa627e15c
parent31036a9e1b09b1d18043e55d3134a2d911d694c0 (diff)
downloadQt-d3bea65eae71a21a7b9893317c4dbafba20f17c8.zip
Qt-d3bea65eae71a21a7b9893317c4dbafba20f17c8.tar.gz
Qt-d3bea65eae71a21a7b9893317c4dbafba20f17c8.tar.bz2
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
-rw-r--r--src/gui/widgets/qlinecontrol.cpp8
1 files 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;
}
}
}