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
Super Contributor
pg1181
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido
Accepted Solution

ToggleButton slot not working as expected

Hi,

 

I've created a SLOT for my ToggleButton's for the following signal:

 

void checkedChanged(bool checked)

 

My SLOT fires properly when I leave out the parameter:

 

ToggleButton* toggle = newToggleButton();

connect(toggle, SIGNAL(checkedChanged(bool)), this, SLOT(toggleChanged()));

 

But when I add a bool parameter:

 

ToggleButton* toggle = newToggleButton();

connect(toggle, SIGNAL(checkedChanged(bool)), this, SLOT(toggleChanged(bool checked)));

 

It no longer fires. From what I read in the documentation I should be able to do this as long as the parameter in the signal and the one in the SLOT are the same, which they are in this case.

 

What am I doing wrong?

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: ToggleButton slot not working as expected

Hi, you should not use a parameter name in a signal or slot declaration... Can you try with SLOT(toggleChanged(bool)) Are you capturing QDebug output? You will see warnings about connection failures...
--
Rob is no longer associated with BlackBerry.
Please use plain text.
Developer
ekke
Posts: 1,510
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: ToggleButton slot not working as expected

its recommended to test if connect(...) was successfull

 

bool ok = connect(....)

if (!ok) {qDebug() ...}

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Super Contributor
pg1181
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido

Re: ToggleButton slot not working as expected

I've seen no output about connection failures, but you were right about the parameter name. I did as you suggested and all is well.

 

Thank you very much!

Please use plain text.
Super Contributor
pg1181
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido

Re: ToggleButton slot not working as expected

@Ekke

Thanks, you're right, this is always better practice and I will use this in my code.
Please use plain text.