Is it possible to get a list of values from each spinbox and put them into a list?
for (int i = 0; i < norm_size+1; i++){
getSpinleftValue(i);
}
I use a for loop to set up all my connections
.
void GuiTest::getSpinleftValue(int index){
QSpinBox* spinleft[norm_size+1] = {ui->norm_spinBox_9,
ui->norm_spinBox_10,
ui->norm_spinBox_11,
ui->norm_spinBox_12,
ui->norm_spinBox_13,
ui->norm_spinBox_14,
ui->norm_spinBox_15,
ui->norm_spinBox_16};
QObject::connect(spinleft[index], SIGNAL(valueChanged(int)), this, SLOT(spinboxWrite(int, index)));
}
.
then once the connections are made by the for loop, I wanted to write their outputs into a list to be used later.
.
void GuiTest::spinboxWrite(int arg1, int index){
int norm_list[16];
qDebug() << arg1;
qDebug() << index;
}
in this case I'm using some debug functions so I can see if they're working. Right now it doesn't look like it's working, because I'm not writing the "connect" part right.
No such slot GuiTest::spinboxWrite(int, index) in
I know the other solution is to create a bunch of these
void GuiTest::on_norm_spinBox_9_valueChanged(int arg1)
{
//code here
}
But I'd rather not pollute my entire file with 16 of these if I can help it!