summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-07 10:22:01 (GMT)
committeraxis <qt-info@nokia.com>2009-05-04 11:11:13 (GMT)
commit9e838079f5f8d62aebb542f2415cd77ef9d71df2 (patch)
tree9cc5359bab7c15c6f6074e802685d42b9728847f
parent27e57ccd327fbc1edbb23d9959c5388023974dfc (diff)
downloadQt-9e838079f5f8d62aebb542f2415cd77ef9d71df2.zip
Qt-9e838079f5f8d62aebb542f2415cd77ef9d71df2.tar.gz
Qt-9e838079f5f8d62aebb542f2415cd77ef9d71df2.tar.bz2
Added an event to request and close software input panel.
This is meant to be used by widgets to signal that they want input. The event will then be passed on to QInputContext::filterEvent, which can create an appropriate virtual keyboard on devices with touch interface only. RevBy: denis
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/kernel/qcoreevent.h3
-rw-r--r--src/gui/inputmethod/qinputcontext.cpp14
-rw-r--r--src/gui/kernel/qapplication.cpp14
4 files changed, 32 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 11a2d3c..e0be174 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -108,6 +108,7 @@ QT_BEGIN_NAMESPACE
\value ApplicationLayoutDirectionChange The default application layout direction has changed.
\value ApplicationPaletteChange The default application palette has changed.
\value ApplicationWindowIconChange The application's icon has changed.
+ \value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP).
\value ChildAdded An object gets a child (QChildEvent).
\value ChildInserted An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead.
\value ChildPolished A widget child gets polished (QChildEvent).
@@ -186,6 +187,7 @@ QT_BEGIN_NAMESPACE
\value Polish The widget is polished.
\value PolishRequest The widget should be polished.
\value QueryWhatsThis The widget should accept the event if it has "What's This?" help.
+ \value RequestSoftwareInputPanel A widget wants to open a software input panel (SIP).
\value Resize Widget's size changed (QResizeEvent).
\value Shortcut Key press in child for shortcut key handling (QShortcutEvent).
\value ShortcutOverride Key press in child, for overriding shortcut key handling (QKeyEvent).
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index fa472e6..d229ac9 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -266,6 +266,9 @@ public:
CocoaRequestModal = 190, // Internal for requesting an application modal Cocoa Window
MacGLClearDrawable = 191, // Internal Cocoa, the window has changed, so we must clear
+ RequestSoftwareInputPanel = 192,
+ CloseSoftwareInputPanel = 193,
+
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event
diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp
index 3d6d303..dba377a 100644
--- a/src/gui/inputmethod/qinputcontext.cpp
+++ b/src/gui/inputmethod/qinputcontext.cpp
@@ -209,7 +209,19 @@ void QInputContext::setFocusWidget(QWidget *widget)
way. Although the input events have accept() and ignore()
methods, leave it untouched.
- \a event is currently restricted to QKeyEvent and QMouseEvent.
+ \a event is currently restricted to events of these types:
+
+ \list
+ \i CloseSoftwareInputPanel
+ \i KeyPress
+ \i KeyRelease
+ \i MouseButtonDblClick
+ \i MouseButtonPress
+ \i MouseButtonRelease
+ \i MouseMove
+ \i RequestSoftwareInputPanel
+ \endlist
+
But some input method related events such as QWheelEvent or
QTabletEvent may be added in future.
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index d65a352..6f0a4e6 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -4040,6 +4040,20 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
#endif
+ case QEvent::RequestSoftwareInputPanel:
+ case QEvent::CloseSoftwareInputPanel:
+#ifndef QT_NO_IM
+ if (receiver->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(receiver);
+ QInputContext *ic = w->inputContext();
+ if (ic && ic->filterEvent(e)) {
+ break;
+ }
+ }
+#endif
+ res = d->notify_helper(receiver, e);
+ break;
+
default:
res = d->notify_helper(receiver, e);
break;