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
fiferboy
Posts: 13
Registered: ‎02-17-2012
My Device: Torch 9600, Playbook
Accepted Solution

Hiding virtual keyboard in Qt?

[ Edited ]

I have a Qt application that runs well in the simulator. When a widget that needs the keyboard has focus the virtual keyboard pops up properly. The problem is, when a widget that does not need the keyboard has focus the VKB is still showing and has to be manually closed by the user.

 

Is the expected functionality of VKB that it auto-hides when not need by whatever has active focus? Is there some way to prgramatically hide the keyboard? I looked at the qbbvirtualkeyboard source, but it doesn't seem to have any include files in the system to use in my program. It looks like it is intended to be a quiet helper rather than something actively called.

 

An unrelated future question would be whether there is a way to access the "swipe down" gesture in Qt to open an application menu the way other native applications do.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Hiding virtual keyboard in Qt?

try this code:

QBBVirtualKeyboard::instance().hideKeyboard();

Please use plain text.
Contributor
fiferboy
Posts: 13
Registered: ‎02-17-2012
My Device: Torch 9600, Playbook

Re: Hiding virtual keyboard in Qt?

Thanks for the reply.  I get:

 

'QBBVirtualKeyboard' has not been declared

 

I take it I need to add an include to my source file, or something to my project file. Any ideas?

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Hiding virtual keyboard in Qt?

Sure, you have to include

#include"qbbvirtualkeyboard.h"

 

and link with -l blackberry -L /<wherever_you_cloned_QT_to>/Qt/stage/nto/armle-v7/usr/lib/qt4/plugins/platforms

Please use plain text.
Contributor
fiferboy
Posts: 13
Registered: ‎02-17-2012
My Device: Torch 9600, Playbook

Re: Hiding virtual keyboard in Qt?

Ok, that compiles fine for armel but I don't have a device to test on.

 

When I try compiling for x86 to run in the simulator, I get the following error after adding in the linker statement:

 

/home/fiferboy/Qt/stage/nto/x86/usr/lib/qt4/plugins/platforms/libblackberry.so:-1: error: undefined reference to `QGLPixmapData::QGLPixmapData(QPixmapData::smileytongue:ixelType)'

 

Maybe to do with the different version of openGL used for the x86? x86  uses OpenGL ES 1.0 and armel ises ES 2.0. Still, it seems like I am close now, I just want to test in the simulator.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Hiding virtual keyboard in Qt?

Are you linking with QTOpenGL library?
Please use plain text.
Contributor
fiferboy
Posts: 13
Registered: ‎02-17-2012
My Device: Torch 9600, Playbook

Re: Hiding virtual keyboard in Qt?

I have 'QT += opengl' in my project file.

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Hiding virtual keyboard in Qt?

I have no idea what it means, I build my project using Momentics IDE. In any case I've spotted number of behavioural differences between Playbook and Simulator. I would not waste time and effort on Simulator.
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Hiding virtual keyboard in Qt?

Yes, I checked and that was exactly what I meant: QGLPixmapData does not exist in QtOpenGL compiled for SImulator and it does exist in QtOpenGl compiled for Playbook.

Sad -(

Please use plain text.
Contributor
fiferboy
Posts: 13
Registered: ‎02-17-2012
My Device: Torch 9600, Playbook

Re: Hiding virtual keyboard in Qt?

Yeah, so I can't test that function in the simulator. I built an arm version and got a friend to test on the playbook but the application wouldn't launch. It does launch without that function.

 

I'll try again when I get some hardware I can test further on with more debugging. Thanks for the help.

Please use plain text.