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
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

QT and catching cursor movement keys

Hello,

apparently I am doing something wrong as I can't catch left, right, up and down keys pressed events in my QT app.

Class is derived from QMainWindow

class CMainWindow : public QMainWindow
{
...

void CMainWindow::keyPressEvent(QKeyEvent *event)
{
	qDebug()<<event->key();
	QMainWindow::keyPressEvent(event);
        event->accept();
}

 When I press these keys I always have QT::Key_ESC code here. Tested in QT Builder and having the same behaviour. Qt experts please advise.

Thanks,

BGmot.

 

Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: QT and catching cursor movement keys

Hi BGmot,

I am afraid I am not much help here as I have not messed around with any key events in Qt c++.

Here is the docs, I am sure you have already been through this though...

http://qt-project.org/doc/qt-4.8/qkeyevent.html

Here is a basic example:

http://programmingexamples.wikidot.com/qt-events#toc3

 

I have had input issues with Qt widgets that turned out to be a focus issue, be sure the widget that you want to accept input has focus.

Good Luck!

Jon

 

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

Re: QT and catching cursor movement keys

Hi Jon,

no, it's not a focus related issue as I *am receiving* events it's just event->key() returns Escape code instead of cursor movement keys codes.

Thanks anyway.