Potch
4th May 2008, 12:10
Hello,
This is the first time I use Qt and I need an advice to perform the following task.
With this loop, I display a combobox on each column of the first row of my QTableWidget.
for (int col=0 ; col <= colonnes ; ++col)
{
QComboBox *moncombo = new QComboBox;
moncombo->addItems(PL_variables);
TableW->setCellWidget(0, col, moncombo);
connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int)));
}
With connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int))); I can transmet the index of the combo to the slot.
My problem is that I also have to transmet the number of the column on which the signal had been sent.
I guess I should to use the horizontalHeader function or something like that, but I don't really know how to do this.
Thanks
This is the first time I use Qt and I need an advice to perform the following task.
With this loop, I display a combobox on each column of the first row of my QTableWidget.
for (int col=0 ; col <= colonnes ; ++col)
{
QComboBox *moncombo = new QComboBox;
moncombo->addItems(PL_variables);
TableW->setCellWidget(0, col, moncombo);
connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int)));
}
With connect(moncombo, SIGNAL(activated(int)),this, SLOT(associate(int))); I can transmet the index of the combo to the slot.
My problem is that I also have to transmet the number of the column on which the signal had been sent.
I guess I should to use the horizontalHeader function or something like that, but I don't really know how to do this.
Thanks