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: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus
Accepted Solution

SystemToast finished SIGNAL Not Emitted

Any idea why this happens? Is it a bug?

 

void HelpPage::showToastNotification()
{
	SystemToast *toast = new SystemToast(this);
	toast->setBody("Success.");
	toast->button()->setLabel("Open");

	QObject::connect(toast, SIGNAL(finished(SystemUiResult::Type)),
	        this,  SLOT(onToastFinished(SystemUiResult::Type)));

	toast->show();
}

void HelpPage::onToastFinished(bb::system::SystemUiResult::Type result)
{
      showDialog("Test","Success"); //THIS LINE NEVER GETS CALLED

      SystemToast *toast = qobject_cast<SystemToast *>(sender());
      toast->deleteLater();
}
jayvdiyk.com
Developer
Posts: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus

Re: SystemToast finished SIGNAL Not Emitted

Anyone please, im really puzzled why it doesnt work, while it should....
jayvdiyk.com
Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: SystemToast finished SIGNAL Not Emitted

Hi Jayvd,

 

  Please check below link

 

 https://developer.blackberry.com/cascades/documentation/ui/dialogs_toasts/toasts.html

 

-------------------------------------------------------------------------------

 

feel free to press the like button on the right side to thank the user that helped you.

Developer
Posts: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus

Re: SystemToast finished SIGNAL Not Emitted

I read that before, everything I did according to docs and still it doesnt work.
jayvdiyk.com
Developer
Posts: 107
Registered: ‎05-11-2011
My Device: BlackBerry Z10 LE
My Carrier: AirTel

Re: SystemToast finished SIGNAL Not Emitted

[ Edited ]

Hi,

 

Use full namespace in parameter list.

 

.hpp

public slots:
void onToastFinished(bb::system::SystemUiResult::Type);

 .cpp

 

#include "applicationui.hpp"

#include <bb/cascades/QmlDocument>
#include <bb/system/SystemToast>

using namespace bb::cascades;
using namespace bb::system;

ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
		QObject(app) {
	QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
	qml->setContextProperty("app", this);
	root = qml->createRootObject<AbstractPane>();
	app->setScene(root);

	SystemToast *toast = new SystemToast(this);
	toast->setBody("Success.");
	toast->button()->setLabel("Open");

	QObject::connect(toast, SIGNAL(finished(bb::system::SystemUiResult::Type)), this,
			SLOT(onToastFinished(bb::system::SystemUiResult::Type)));

	toast->show();
}

void ApplicationUI::onToastFinished(bb::system::SystemUiResult::Type result) {
	qDebug() << "Got it";
	SystemToast *toast = qobject_cast<SystemToast *>(sender());
	toast->deleteLater();
}

 

Developer
Posts: 188
Registered: ‎04-07-2013
My Device: BlackBerry Z10
My Carrier: Telus

Re: SystemToast finished SIGNAL Not Emitted

Thanksss
jayvdiyk.com