Quoting "Jose M. Sanchez" <[EMAIL PROTECTED]>:
>
> Hi,
>
> I have different widgets created in a generic way with slots connected
> to the same method. How can I know which widget triggered the event?
>
> void Test::createWidgets()
> {
> WText *text1 = new WText(...);
> WText *text2 = new WText(...);
> WText *text3 = new WText(...);
>
> text1->clicked.connect(SLOT(this, Test::onClick));
> text2->clicked.connect(SLOT(this, Test::onClick));
> text3->clicked.connect(SLOT(this, Test::onClick));
> }
>
>
>
> void Test::onClick()
> {
> // how do I know here which WText was clicked?
>
> WObject *sender = clicked.sender();
> // sender() is the instance of the Test class, not the WText widget
> }
>
>
> Thanks in advance,
Use WSignalMapper
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest