[Qt-interest] Multiple signals to one slot

Neville Dastur qt at dastur.me.uk
Sat Jan 30 21:09:41 CET 2010


Hi

I have a group of checkboxes. Using the QSignalMapper I "connect" all of 
them to a single member function

connect(ui->checkBoxDescriptionStatus_Current,
    SIGNAL(stateChanged(int)),
    m_signalMapperDescriptionFilters,
    SLOT(map()));
connect(ui->checkBoxDescriptionStatus_Retired,
    SIGNAL(stateChanged(int)),
    m_signalMapperDescriptionFilters,
    SLOT(map()));

etc ...

I use the setMapper to specify a int for each checkbox

m_signalMapperDescriptionFilters->setMapping(ui->checkBoxDescriptionStatus_Current,
    NBD::ND_SNOMED_DESCRIPTIONSTATUS_Current);
m_signalMapperDescriptionFilters->setMapping(ui->checkBoxDescriptionStatus_Retired, 

    NBD::ND_SNOMED_DESCRIPTIONSTATUS_Retired);

and finally connect the whole thing together with:
connect(m_signalMapperDescriptionFilters,
    SIGNAL(mapped(int)),
    this,
    SLOT(map_DescriptionStatusFilterChange(int)));

My problem now is how do a get the actual state of the checkbox that 
fired the signal?



More information about the Qt-interest-old mailing list