From c6bda755a2d0cad93520dbd75dc2880a1c9409e2 Mon Sep 17 00:00:00 2001 From: Kevin Krammer Date: Wed, 29 Feb 2012 15:31:09 +0100 Subject: React to changes of focus widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needed to automatically show/hide virtual keyboard when focus changes in or out of an input widget Change-Id: I21325452938e1d551bcc4421721f3bc5d85c5fbf Reviewed-by: Sean Harmer Reviewed-by: Rafael Roquetto Reviewed-by: Nick Ratelle Reviewed-by: Jørgen Lind --- src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp | 13 +++++++++++++ src/plugins/platforms/blackberry/qbbinputcontext_noimf.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp index 8894098..a5b959b 100644 --- a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp +++ b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp @@ -99,3 +99,16 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, return false; } +void QBBInputContext::setFocusWidget(QWidget *w) +{ +#if defined(QBBINPUTCONTEXT_DEBUG) + qDebug() << Q_FUNC_INFO << (w ? "requesting" : "hiding") << "virtual keyboard"; +#endif + QInputContext::setFocusWidget(w); + + if (w) + QBBVirtualKeyboard::instance().showKeyboard(); + else + QBBVirtualKeyboard::instance().hideKeyboard(); +} + diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h index d7f3cc5..6332ee7 100644 --- a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h +++ b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h @@ -58,6 +58,8 @@ public: virtual bool filterEvent( const QEvent *event ); bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); + void setFocusWidget(QWidget *w); + private: bool hasPhysicalKeyboard(); -- cgit v0.12