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
smiley
Posts: 1,468
Registered: ‎07-14-2008
My Device: Z10
Accepted Solution

How to connect NotificationDialog finished() signal?

Can't seem to find any doc on how to properly connect the finished signal.

 

I have this for the notificationdialog in my c file

 

        bool success = QObject::connect(pNotification,
                SIGNAL(finished(bb::smileytongue:latform::NotificationResult::ButtonSelection*)),
                this,
                SLOT(onSelected(bb::smileytongue:latform::NotificationResult::ButtonSelection*)));

void myApp::smileysurprised:nSelected(bb::smileytongue:latform::NotificationResult *button)
{
}

in my h file i have this

 

public Q_SLOTS:
    void onSelected(bb::smileytongue:latform::NotificationResult *button);

what is the proper way to connect this?  thanks

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How to connect NotificationDialog finished() signal?

[ Edited ]

Hi,

 

Please try the following:

#include <bb/platform/NotificationDialog>
using namespace bb::platform;

NotificationDialog *pNotification = .....;

[...]
QObject::connect(pNotification, SIGNAL(finished(bb::platform::NotificationResult::Type)), this, SLOT(onSelected(bb::platform::NotificationResult::Type));

[...]

void myApp::onSelected(bb::platform::NotificationResult::Type value)
{
...
}

 Use buttonSelection() function to get the selected button in signal's handler:

 

NotificationDialog *dialog = qobject_cast<NotificationDialog *>(sender()); // or reference a member variable directly
if (dialog)
{
  SystemUiButton *button = dialog->buttonSelection();
  ...
}

 

 

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
congdanhqx
Posts: 115
Registered: ‎10-22-2012
My Device: Developer

Re: How to connect NotificationDialog finished() signal?

For clearly answer:

#include <bb/platform/NotificationDialog>
using namespace bb::platform;

NotificationDialog *pNotification = .....;

[...]
QObject::connect(pNotification, SIGNAL(finished(bb::platform::NotificationResult::Type)), this, SLOT(onSelected(bb::platform::NotificationResult::Type));

[...]

void myApp::onSelected(bb::platform::NotificationResult::Type value)
{ NotificationDialog *dialog = qobject_cast<NotificationDialog *>(sender()); // or reference a member variable directly if (dialog) { SystemUiButton *button = dialog->buttonSelection(); ... }


Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Please use plain text.
Developer
smiley
Posts: 1,468
Registered: ‎07-14-2008
My Device: Z10

Re: How to connect NotificationDialog finished() signal?

Thanks guys. :Clap:

Please use plain text.
Developer
congdanhqx
Posts: 115
Registered: ‎10-22-2012
My Device: Developer

Re: How to connect NotificationDialog finished() signal?

If you think the answer is good, please give us a like :smileyhappy: Thanks you.


Like my answer if it's helpful. Mark as answer if it help you solve the problem.
Please use plain text.