I've looked through the webs for an answer to this question which I'm sure has been answered a few dozen times before, but I can't find anything regarding it, so...

How can I re-cast a SIGNAL or SLOT? For instance, I have a QCheckBox which I want to connect to a QLineEdit so that if the Box is unchecked, the LineEdit is disabled.

My first idea was of course to use:
Qt Code:
  1. connect(box,SIGNAL(stateChanged(int)),LineEdit,setEnabled(bool)));
To copy to clipboard, switch view to plain text mode 

Since stateChanged emits a 0 if unchecked and a 2 if checked (1 if partially checked, which isn't relevant in my case), that'd work well.

However, as I was already aware, the SIGNAL and SLOT need to have the same arguments. I was hoping that since int can be implicitly cast to a bool (0 == false, everything else == true), it'd work, but it doesn't.

So now I'm stuck. Any hints?