summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-07-14 01:31:57 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-07-14 01:31:57 (GMT)
commit960332de7ae1206390169fb5ef03aa94dffb8f14 (patch)
tree26a5ff78a2a9b91791f43230004690ca0f7abc2e
parent2718577ecf7a4a5c9fc619a46ee79a468044b4d7 (diff)
downloadQt-960332de7ae1206390169fb5ef03aa94dffb8f14.zip
Qt-960332de7ae1206390169fb5ef03aa94dffb8f14.tar.gz
Qt-960332de7ae1206390169fb5ef03aa94dffb8f14.tar.bz2
Actually, some of that can't be moved back into QLineEdit
Also it should be executed a little later to avoid accidental behaviour changes.
-rw-r--r--src/gui/widgets/qlinecontrol.cpp23
-rw-r--r--src/gui/widgets/qlineedit.cpp58
2 files changed, 43 insertions, 38 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index dd3c057..e6f397a 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -1212,6 +1212,29 @@ void QLineControl::timerEvent ( QTimerEvent * event )
bool QLineControl::processEvent(QEvent* ev)
{
+#ifdef QT_KEYPAD_NAVIGATION
+ if (QApplication::keypadNavigationEnabled()) {
+ if ((ev->type() == QEvent::KeyPress) || (ev->type() == QEvent::KeyRelease)) {
+ QKeyEvent *ke = (QKeyEvent *)ev;
+ if (ke->key() == Qt::Key_Back) {
+ if (ke->isAutoRepeat()) {
+ // Swallow it. We don't want back keys running amok.
+ ke->accept();
+ return true;
+ }
+ if ((ev->type() == QEvent::KeyRelease)
+ && !isReadOnly()
+ && deleteAllTimer) {
+ killTimer(m_deleteAllTimer);
+ m_deleteAllTimer = 0;
+ backspace();
+ ke->accept();
+ return true;
+ }
+ }
+ }
+ }
+#endif
switch(ev->type()){
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseMove:
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index b0c48b0..92dcfc4 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1361,44 +1361,6 @@ void QLineEdit::paste()
bool QLineEdit::event(QEvent * e)
{
Q_D(QLineEdit);
-#ifdef QT_KEYPAD_NAVIGATION
- if (QApplication::keypadNavigationEnabled()) {
- if ((ev->type() == QEvent::KeyPress) || (ev->type() == QEvent::KeyRelease)) {
- QKeyEvent *ke = (QKeyEvent *)ev;
- if (ke->key() == Qt::Key_Back) {
- if (ke->isAutoRepeat()) {
- // Swallow it. We don't want back keys running amok.
- ke->accept();
- return true;
- }
- if ((ev->type() == QEvent::KeyRelease)
- && !isReadOnly()
- && deleteAllTimer) {
- killTimer(m_deleteAllTimer);
- m_deleteAllTimer = 0;
- backspace();
- ke->accept();
- return true;
- }
- }
- } else if (e->type() == QEvent::EnterEditFocus) {
- end(false);
- int cft = QApplication::cursorFlashTime();
- control->setCursorBlinkPeriod(cft/2);
- } else if (e->type() == QEvent::LeaveEditFocus) {
- d->setCursorVisible(false);//!!!
- control->setCursorBlinkPeriod(0);
- if (!m_emitingEditingFinished) {
- if (hasAcceptableInput() || fixup()) {
- m_emitingEditingFinished = true;
- emit editingFinished();
- m_emitingEditingFinished = false;
- }
- }
- }
- return;
- }
-#endif
if (e->type() == QEvent::Timer) {
// should be timerEvent, is here for binary compatibility
int timerId = ((QTimerEvent*)e)->timerId();
@@ -1424,6 +1386,26 @@ bool QLineEdit::event(QEvent * e)
d->control->setLayoutDirection((layoutDirection()));
}
+#ifdef QT_KEYPAD_NAVIGATION
+ if (QApplication::keypadNavigationEnabled()) {
+ if (e->type() == QEvent::EnterEditFocus) {
+ end(false);
+ int cft = QApplication::cursorFlashTime();
+ d->control->setCursorBlinkPeriod(cft/2);
+ } else if (e->type() == QEvent::LeaveEditFocus) {
+ d->setCursorVisible(false);
+ d->control->setCursorBlinkPeriod(0);
+ if (!d->control->emitingEditingFinished) {
+ if (d->control->hasAcceptableInput() || d->control->fixup()) {
+ d->control->emitingEditingFinished = true;
+ emit editingFinished();
+ d->control->emitingEditingFinished = false;
+ }
+ }
+ }
+ return;
+ }
+#endif
return QWidget::event(e);
}