Table Widget selected item doesnt take the first one
-
wrote on 19 Mar 2021, 14:33 last edited by deleted286
Here is the code script that i take the selected ones
``` QList<QTableWidgetItem*> MySelList = ui->tableWidget->selectedItems(); for (QTableWidgetItem* item : MySelList) { double TheText = item->text().toDouble(); qDebug() << TheText;
But it doesnt take the first one that i select  This give me the output like : 0.56 0.58
-
Here is the code script that i take the selected ones
``` QList<QTableWidgetItem*> MySelList = ui->tableWidget->selectedItems(); for (QTableWidgetItem* item : MySelList) { double TheText = item->text().toDouble(); qDebug() << TheText;
But it doesnt take the first one that i select  This give me the output like : 0.56 0.58
wrote on 19 Mar 2021, 15:15 last edited by JonB@suslucoder said in Table Widget selected item doesnt take the first one:
But it doesnt take the first one that i select
Yes, this code will visit all selected items, including whatever "first one" which you say it does not include. Else everybody would be complaining about it.
Why don't you print out:
qDebug() << ui->tableWidget->selectedItems().length();
1/2