Hi Sergey,

sergey bryukov wrote:
> Hello!
> How to define from witch object has just signal came?
> Example in the attachment redirects several widget's signals to  the 
> single SLOT. So, how to define each widget inside of SLOT?
> Thanks!
>

Use WSignalMapper like so;

    WSignalMapper<WRadioButton*>* radio_map = new
WSignalMapper<WRadioButton*>( this );
    radio_map->mapped.connect( SLOT( this, casIndividualList::buildTable
) );
    WButtonGroup* rGroup = new WButtonGroup( this );
    WRadioButton* all = new WRadioButton ( "All", this ); // I need a
pointer to "All" later on
    rGroup->addButton( all );
    radio_map->mapConnect( all->clicked, all );
    WRadioButton* rb = new WRadioButton ( "Staff", this );
    rGroup->addButton( rb );
    radio_map->mapConnect( rb->clicked, rb );
    rb = new WRadioButton ( "Users", this ); // reusing rb
    rGroup->addButton( rb );

and later,

void casIndividualList::buildTable( WRadioButton* selected )
{
            query<<"SELECT individualID, firstName, surname,
phoneNumber, mobileNumber, emailAddress from individual";
            if( selected->text() == "Staff" )
                query<<" WHERE staff = TRUE";
            else if( selected->text() == "Users" )
                query<<" WHERE serviceUser = TRUE";
            query<<" ORDER BY individualID ASC";
}

Hope this helps,
Brad


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to