I don't know why when I click the two radio buttons no text is output via QSignalMapper:
class:
private slots:
private:
void set_mappings();
Ui::SettingsWindow *ui;
private slots:
void clicked(QString text);
private:
void set_mappings();
Ui::SettingsWindow *ui;
QSignalMapper *mapper;
To copy to clipboard, switch view to plain text mode
constructor:
set_mappings();
mapper = new QSignalMapper(this);
set_mappings();
To copy to clipboard, switch view to plain text mode
inside set_mappings() and clicked()
void SettingsWindow::set_mappings()
{
connect(ui->general_radio_backLightOff, SIGNAL(clicked()), mapper, SLOT(map()));
mapper->setMapping(ui->general_radio_backLightOff,"general_radio_backLightOff");
connect(ui->general_radio_backLightOn, SIGNAL(clicked()), mapper, SLOT(map()));
mapper->setMapping(ui->general_radio_backLightOn,"general_radio_backLightOn");
connect(mapper,
SIGNAL(mapped
(QString)),
this,
SIGNAL(clicked
(QString)));
}
void SettingsWindow
::clicked(QString text
) {
qDebug() << text;
}
void SettingsWindow::set_mappings()
{
connect(ui->general_radio_backLightOff, SIGNAL(clicked()), mapper, SLOT(map()));
mapper->setMapping(ui->general_radio_backLightOff,"general_radio_backLightOff");
connect(ui->general_radio_backLightOn, SIGNAL(clicked()), mapper, SLOT(map()));
mapper->setMapping(ui->general_radio_backLightOn,"general_radio_backLightOn");
connect(mapper,SIGNAL(mapped(QString)),this,SIGNAL(clicked(QString)));
}
void SettingsWindow::clicked(QString text)
{
qDebug() << text;
}
To copy to clipboard, switch view to plain text mode
Bookmarks