Thank you for your advise Wysota. I'm currently learning Qt and custom delegates is the next chapter for me Normaly, they are only 8 of them, so it's not to slow to execute.
I could finaly manage to retrieve the number of column as follow :
for (int col=0 ; col <= colonnes ; ++col)
{
moncombo->addItems(PL_variables);
moncombo
->setObjectName
(QString::number(col
));
// the name of my combo is the number of my column TableW->setCellWidget(0, col, moncombo);
connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int)));
}
for (int col=0 ; col <= colonnes ; ++col)
{
QComboBox *moncombo = new QComboBox;
moncombo->addItems(PL_variables);
moncombo->setObjectName(QString::number(col)); // the name of my combo is the number of my column
TableW->setCellWidget(0, col, moncombo);
connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int)));
}
To copy to clipboard, switch view to plain text mode
The slot
void MainWindow::associate(int index)
{...
int c = sender()->objectName().toInt();
...}
void MainWindow::associate(int index)
{...
int c = sender()->objectName().toInt();
...}
To copy to clipboard, switch view to plain text mode
Regarding to the documentation, it's not a very correct way to do this... That's why I try to implement another solution using QSignalMapper.
Thanks for your advices...
Bookmarks