You are declaring final_a
and final_b
on the stack, but then referring to them as ui->final_a
and ui->final_b
. Try removing the "ui->
" from those.
In general, I think your approach could be simplified, though. For example, say you have pointers to your combo boxes stored in an array called comboBoxes
. Then you can just do this:
// create the combo boxes somewhere in your program, perhaps like this:
QComboBox *comboBoxes[8];
for (int i = 0; i < 8; ++i)
{
comboBoxes[i] = new QComboBox;
}
// Slot to check if there's two channels with the same option choosed
void gui::check_channels_options()
{
for (int a = 0; a < 8; ++a)
{
for (int b = 0; b < 8; ++b)
{
if (a == b ||
comboBoxes[a]->currentText() == "none" ||
comboBoxes[b]->currentText() == "none")
continue; // no need to test these for equality
else if (comboBoxes[a]->currentText() == comboBoxes[b]->currentText)
// issue warning
else
// they are OK
}
}
}