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
mzex
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C

QWebView shift key bizarre problem

I compiled succesfully QwebView for Qnx/Arm, and it is working OK, but my app crash as soon as user press SHIFT key on virtual keyboard while it is focused on some html input field.

I tried to override keypress event and in event i see that shift key have proper key code: 0x1000020. Here is code snippet in my override method:

void QtWebView::keyPressEvent(QKeyEvent* event) {
 int key = event->key();
if ( key != 16777248 )
          QWebView::keyPressEvent(event);


}

 However, my app still crashes, i can't prevent it with this override. If for testing i put key != 65 (key "a") app successfuly prevent letter "a" in html text input.

Developer
mzex
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C

Re: QWebView shift key bizarre problem

Discovered that qupzilla and arora web browsers ports for playbook which uses webkit also crashing when shift key is pressed.

BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: QWebView shift key bizarre problem

Just to be thorough, can you do a few things:

- test that the passed parameter is non-null and qDebug() (and return) if it is

- qDebug()  the values of the keystrokes prior to calling

- qDebug() at end of routine so we know it has returned

 

Then post the log.

 

Stuart

Developer
mzex
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C

Re: QWebView shift key bizarre problem

Sure, this is my keypress handler for QtWEbView:

bool KeyPressEater::eventFilter(QObject *obj, QEvent *event)
 {
     if (event->type() == QEvent::KeyPress) {
         QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
      qDebug("Got KeyPress event, Key code %d", keyEvent->key());

         if(keyEvent->key() != Qt::Key_Shift){
               qDebug("It is not SHIFT key, Key code %d", keyEvent->key());
              return QObject::eventFilter(obj, event);
         } else {


         qDebug("Got SHIFT key %d", keyEvent->key());
       
         return true;
        }
     } else {
         // standard event processing
          qDebug("This is not keypress event, returning it");
         return QObject::eventFilter(obj, event);
     }
 }

 For testing, i first press letter "a" and this is log from it:

Got KeyPress event, Key code 65

It is not SHIFT key, Key code 65

 

Now i pres shift key:

Got KeyPress event, Key code 16777248

Got SHIFT key 16777248

and app crash after this.

 

16777248 is proper shift code (hex 0x1000020)

I made this keypress override in effort to prevent SHIFt key crash. I cant write in log what is before this method, because this is set eventfilter override:

_webView->installEventFilter(keyPressEater);

After that shift, when app exits this method, it crashes.

It is not problem in my app, same behaviour i get with qupzilla and arora web browsers ports for playbook.

 If needed, i can zip all project and attach it here.

 

BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: QWebView shift key bizarre problem

Hi there,

 

Where did you obtain the QWebView build for arm?

Developer
mzex
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C

Re: QWebView shift key bizarre problem

[ Edited ]

I compiled QtWebview following Hatax instructions from here http://supportforums.blackberry.com/t5/Native-Development/Qt-WebKit/td-p/1388513

 

I am not trying to make fancy new web browser with it, just need it to implement Oauth authentification in my app.

BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: QWebView shift key bizarre problem

I am not so familiar with QWebView, but it is definitely odd that this only happens with the shift key. You may want to touch base with Hatax about this issue, given that you are using his port;

 

Martin