c++ - Toggling a QPushButton -


i have simple gui:

a qpushbutton, when clicked, number (say 11) shall shown (i use qlcdnumber this). when clicked again number shall shown (say 10).

my aim use qabstractbutton::toggled ( bool checked ) feature this.

as learned, proper signal-slot-connection this:

connect(ui.startstopbutton, signal(toggled(bool)), thread, slot(start())); 

(i additionally use threads they're not problem)

my question: how can differ between "the button toggled" (checked = true) , "the button not toggled" (ckecked = false) in signal-slot-statement?

i used variations signal(toggled(bool = true)), signal(toggled(bool checked = true)) or signal(toggled(true)) neither working. allways debugger message:

object::connect: no such signal qpushbutton::toggled(bool = true) in testthread.cpp:15 object::connect:  (sender name:   'startstopbutton') 

i have enabled setcheckable of button.

the signal toggled(bool), receiving end has bool parameter too:

connect(ui.startstopbutton, signal(toggled(bool)), thread, slot(start(bool))); 

this way boolean value sent toggle signal, received slot. in slot function, can check if received boolean true or not.

here assumed thread:start() function wrote, if not, create new slot check value of boolean, , start thread.

connect(ui.startstopbutton, signal(toggled(bool)), threadstarter, slot(start(bool))); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -