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:
void boxDataChanged(const int & str);
QComboBox * editor = new QComboBox(parent);
connect(editor, SIGNAL(currentIndexChanged(int)), this, SIGNAL(boxDataChanged(int)));
connect(mydelegate, &Delegate::boxDataChanged, [=](const int & str)
qDebug() << str;
The problem is I can not identify from witch comboBox the signal is emited from.
You can use
QObject::sender to get the sender of the signal.
It will return a
QObject that you can cast into the desired type.