I started working on a project that requires the using of the TableView. My table has 3 columns and the last column has a comboBox. Using the Delegate I managed to set the comboBox and to retrieve a signal when the index status of the comboBox changes. The problem is I can not identify from witch comboBox the signal is emited from.
If I signal to the mainWindow the QString of the comboBox this seems to be very bad. I was thinking at a solution to insert into the comboBox from each line the index of the row. Something like row + name.
I initiate the connection using the advice from another post, such like:
signals:
void boxDataChanged(const int & str);
In create editor:
QComboBox * editor = new QComboBox(parent);
editor->addItem("This");
editor->addItem("is");
editor->addItem("nice");
connect(editor, SIGNAL(currentIndexChanged(int)), this, SIGNAL(boxDataChanged(int)));
return editor;
And called like:
connect(mydelegate, &Delegate::boxDataChanged, [=](const int & str)
{
qDebug() << str;
});
This is working nice but I also need to know from witch row this is comming.