Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:Listening for Symbian key events in Qt

From Wiki
Jump to: navigation, search

There's a small error in one of the example code snippets. The flagging is off in this:

void QMyWidget::keyPressEvent(QKeyEvent* event)

   {
   #ifdef Q_OS_SYMBIAN
   switch (event->nativeVirtualKey())
     {
     case EKeyUpArrow:
     {
     // Symbian EKeyUpArrow pressed 
     break;
     }
   };
   }
   #endif

The closing #endif should be BEFORE the last bracket, like this:

void QMyWidget::keyPressEvent(QKeyEvent* event)

   {
   #ifdef Q_OS_SYMBIAN
   switch (event->nativeVirtualKey())
     {
     case EKeyUpArrow:
     {
     // Symbian EKeyUpArrow pressed 
     break;
     }
   };
   #endif
   }

not working in S60 3rd FP1 -Emulator with Qt 4.6.2?

I implemented a small Qt-Application, derived from a QDialog.

My QDialog containes several QButtons, QLabels, QLineEdits and so on (via .ui-file).

In the myQDialog.h I declare the 'void keyPressEvent(QKeyEvent *aEvent);' which I also implement in myQDialog.cpp.

But when executing the program in the debugger it never enters that method, no matter what key I press on the emulator.

Does this have something to do with QWidget::setFocusPolicy() ? Is the keyPressEvent possibly 'consumed' by other widgets inside myQDialog?

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×