Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb
Accepted Solution

Detecting keyboard roll-out in Qt applications

Hi

 

I'm porting a Qt application to Playbook, but I'm stumped because, when the virtual keyboard rolls out, it covers up any input elements in the bottom half of the screen. It also covers up any vertical scrollbar that would be able to scroll the form up to get the relevant input elements into view.

 

Is there some sort of event delivered to the application, that would tell it that the keyboard had rolled out (and back in?) It would be easy enough to adjust the application layout to make everything visible, or at least accessible, but so far I've not found any way to figure out how to tell when the virtual keyboard is out.

 

Best wishes

Kevin

 

Contributor
bryanh99
Posts: 43
Registered: ‎06-30-2012
My Device: Bold 9900

Re: Detecting keyboard roll-out in Qt applications

I have solved this "problem" by making the main screen "flickable".  Therefore when the keyboard pops up you can "flick" the screen higher to make any text entry.

 

 

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Detecting keyboard roll-out in Qt applications

I've spent a lot of time trying to figure out the same ending up with patching Qt itself to disable 'automatic' keyboard pop-up/hiding.

Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb

Re: Detecting keyboard roll-out in Qt applications

Hi

 

Some time ago I spent a long time porting Qt to the Archos (pre-Android) devices. My recollection was that so much effort had to be expended in fiddling with the Qt implementation, that there was no time left to work on applications. In the end, the project fizzled out because it just got too frustrating to develop/port applications,  nearly every substantial application required some changes to Qt to make it work properly.

 

Is this how things are with the PlayBook, also? I appreciate that some people have released working Qt-based applications, but the impression that I get is that there's still a lot of work needed on the Qt implementation itself. I could be wrong, of course, and I am impressed with what has been achieved so far.

 

On the Archos platform I solved the keyboard problem by linking the virtual keyboard to the X window manager. When the keyboard popped up, I decreased the size of the window manager's work area, which shrank the Qt main window, and the Qt layout managers (mostly) took care of ajusting the layout. However, PlayBook doesn't have a Window manager (at least, not in the X sense), so I guess such an approach isn't appropriate.

 

What I'm getting around to saying is: if you know how to patch Qt as you describe, how much work would it be to patch it to deliver an event to the application when the keyboard changes state?

 

Best wishes

Kevin

 

 

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Detecting keyboard roll-out in Qt applications

Here is my patch (I did not want Virtual Keyboard to disappear automatically)

diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp b/src/plugins/platforms/blackberry/qbbinputcontext_noi
index 5659f1a..5f8ab0d 100644
--- a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp
+++ b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp
@@ -116,7 +116,7 @@ void QBBInputContext::setFocusWidget(QWidget *w)
 
         mVirtualKeyboard.showKeyboard();
     } else {
-        mVirtualKeyboard.hideKeyboard();
+     //+++   mVirtualKeyboard.hideKeyboard();
     }
 }

If you are good at Qt (I am not) then you can try to play with events QEvent::CloseSoftwareInputPanel and QEvent::RequestSoftwareInputPanel. I could not catch them though...

Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb

Re: Detecting keyboard roll-out in Qt applications

Thanks. Looking at the source for QBBInputContext, it looks like keyboard open/close handling is dealt with at the individual widget level, rather than being delegated to some higher level in the application. I guess it would be possible to modify QBBInputContext to post an event to the application to indicate the keyboard state.

I was rather hoping to be able to get something to work _without_ fiddling with the Qt implementation itself :/
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Detecting keyboard roll-out in Qt applications

>I was rather hoping to be able to get something to work _without_ fiddling with the Qt implementation itself :/

I hoped too. Let's let Qt experts say here -)

Developer
connyhald
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook

Re: Detecting keyboard roll-out in Qt applications

Also try to ask on #qt-qnx on Freenode. There are a bunch of KDAB guys that might be able to help you. Those are the ones doing the Qt work for RIM.

 

-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Contributor
kboone
Posts: 41
Registered: ‎09-14-2012
My Device: Playbook 64Gb

Re: Detecting keyboard roll-out in Qt applications

It turns out that a suggestion made by borceg on a different thread solves this problem --

 

Set the main window size with widget.showMaximized(), rather than setting a specific size. That way, the main window will resize automatically when the keyboard rolls out, and you can detect those size changes and link them to whatever layout changes are necessary.

 

I guess I was thrown off the track here by being more familiar with desktop development. I can't think of a good reason ever to call showMaximzed() on the main window of a desktop application but, clearly, it's more-or-less crucial in this environment.

 

Thanks to all who replied.