Hi. I have numerous checkboxes that are each linked with a respective Spinbox. What I am trying to accomplish, with minimal code, is to append a suffix to the spinbox when the checkbox is checked. I have 8 sets of checkboxes/spinboxes and I am trying to make them utilize a single slot to accomplish my needs. I have tried the following by it seems a slot will not take a parameter unless it is emited by the accompanying signal. I was told briefly that QSignalMapper may be able to fit my needs but I am unsure. Any guidance would be appreciated! Thanks.

Connection:
Qt Code:
  1. QCheckBox* check_[8];
  2. QDoubleSpinBox* grade_SpinBox_[8];
  3.  
  4.  
  5. for (int i = 1; i <= 8; i++)
  6. {
  7. connect(checkbox_[i], SIGNAL(toggled(bool)), this, SLOT(append_suffix(bool, [i])));
  8. }
To copy to clipboard, switch view to plain text mode 

Slot:
Qt Code:
  1. void MainWindow::append_suffix(bool clicked, int checkboxnum)
  2. {
  3. if (clicked == false)
  4. {
  5. grade_SpinBox_[checkboxnum]->setSuffix(QApplication::translate("MainWindow", "%", 0, QApplication::UnicodeUTF8));
  6. }
  7. else
  8. {
  9. ass_grade_SpinBox_[checkboxnum]->setSuffix(QApplication::translate("MainWindow", "", 0, QApplication::UnicodeUTF8));
  10. }
  11. }
To copy to clipboard, switch view to plain text mode