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
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook
Accepted Solution

Qt (not Cascades) and Play/Pause Button

Does anyone know how to capture the Play/Pause Button with Qt? I tried looking for it in a keyPressEvent like I do for the swipe-down menu but nothing gets triggered there.

 

Thanks

Nic

Developer
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook

Re: Qt (not Cascades) and Play/Pause Button

Anybody have an idea? I thought I would bump this after the weekend. Something that may be of interest (and possibly part of the problem) is that when I use Qt Mobility I get an error message in my log: 

Unable to request multimedia events 

 

Anybody now why that would happen? This error is coming the from the standard mmrender_request_events function. Is there a permission/action I need to have? I have this right now:

 

<action system="true">run_native</action>
<action>access_shared</action>
<action>set_audio_volume</action>
<action>play_audio</action>

 

Interestingly I am prompted to accept the file permission but nothing is asked of the audio permissions.

 

Thanks

Nic

BlackBerry Development Advisor
Posts: 54
Registered: ‎10-26-2011
My Device: Playbook

Re: Qt (not Cascades) and Play/Pause Button

Hi, 

 

It’s being investigated internally.  Please log a Feature Request in JIRA and then post the JIRA Item URL back to this thread so we can help you monitor the status of your request. 

 

Anthony

Developer
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook

Re: Qt (not Cascades) and Play/Pause Button

Thanks. Where do I log a Feature Request at?

Nic
Developer
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook

Re: Qt (not Cascades) and Play/Pause Button

New Contributor
Posts: 3
Registered: ‎09-20-2012
My Device: PlayBook 16GB

Re: Qt (not Cascades) and Play/Pause Button

Hi,

 

Support for hardware buttons is now available in Qt 4.8 and Qt 5. See

 

https://codereview.qt-project.org/#change,34304 (Qt5)

https://codereview.qt-project.org/#change,34954 (Qt4)

 

The hardware buttons are mapped to Qt Key press events:

 

bid_minus -> Qt::Key_VolumeDown

bid_playpause -> Qt::Key_Play

bid_plus -> Qt::Key_VolumeUp

bid_power -> Qt::Key_PowerDown

Just override Qwidget::keyPressEvent() or QObject::event() as usual or use an eventFilter to respond to these events.

Developer
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook

Re: Qt (not Cascades) and Play/Pause Button

Awesome! I tested this today and it works as expected.

 

Thanks!

Nic

Developer
Posts: 72
Registered: ‎09-30-2011
My Device: Bold 9930 & PlayBook

Re: Qt (not Cascades) and Play/Pause Button

Is it possible to receive key events when the app is not in focus? I lose them when I switch to another app or if the PlayBook goes to standby.

 

Thanks

New Contributor
Posts: 3
Registered: ‎09-20-2012
My Device: PlayBook 16GB

Re: Qt (not Cascades) and Play/Pause Button

Good question. The honest answer is that I am not sure at the moment. I'll take a look.

Developer
Posts: 67
Registered: ‎12-11-2013
My Device: BlackBerry Z10

Re: Qt (not Cascades) and Play/Pause Button

So is the Qt.Key not working when apps is in background solve?.If the key only work when apps is in foreground state then it kind of useless for me.