[Qt-interest] how can I call a SLOT function and abitrary value parameter.
John McClurkin
jwm at nei.nih.gov
Mon Apr 20 14:17:04 CEST 2009
Giancarlo Amati wrote:
> Hello everybody,
>
> I made my GUI in which I have a main menu. One of the voices has 2
> possible suboptions to be chosen:
>
> VolumeRendering ---> MIP
> |__>COMPOSITE VR
>
>
> so I created the correspondent Actions and then I have my CMainWindows
> class derived from a QMainWindow where I added one slot:
>
> OpenVR(int opt) where I would OPT be 1 if MIP is chosen, or 2 if
> COMPOSITE_VR is Chosen.
>
> now I to create the signal connection I wrote:
>
> QObject::Connect(Ui.ActionMIP,SIGNAL(triggered()), myWin, SLOT(OpenVR(1)));
> QObject::connect(Ui.ActionCOMPOSITE,SIGNAL(triggerer()),myWin,SLOT(OpenVR(2)));
>
> where OpenVR(int opt) is a slot fuction created in CMainWindows class.
>
> Compilation is OK, but unfortunately the Connect returns error message
> like "OpenVR (2)" doesn't exists. So my question is how can I call a
> SLOT function and passing MY arbitrary value depending on the voice in
> my menu?
Your calls to connect are incorrect. They should be:
QObject::Connect(Ui.ActionMIP,SIGNAL(triggered(bool)), myWin,
SLOT(OpenVR(bool)));
QObject::connect(Ui.ActionCOMPOSITE,SIGNAL(triggerer(bool)),myWin,SLOT(OpenVR(bool)));
You can't declare values in the connection statements, only the types of
the arguments of the signals and slots.
>
> Kind Regards.
>
>
> ------------------------------------------------------------------------
> 25 GB di spazio gratuito su Internet! Prova SkyDrive
> <http://clk.atdmt.com/GBL/go/140630366/direct/01/>
More information about the Qt-interest-old
mailing list