I'd like to load QTableWidget with integers and then display selected integers. It seems that QTableWidget can accept integers as shown here:
myTable->setItem(0, 0, newItem); //set object
QTableWidget myTable = new QTableWidget(10, 10, this); //make a 10x10 table
QTableWidgetItem *newItem = new QTableWidgetItem(1); //convert from integer
myTable->setItem(0, 0, newItem); //set object
To copy to clipboard, switch view to plain text mode
But how do you visualize a selected entry from this table (entry 0,0)? The below code evidently does not work because the returned type is wrong.
int a = myTable->item(0,0);
int a = myTable->item(0,0);
To copy to clipboard, switch view to plain text mode
I'd have to do this
QTableWidgetItem *a = myTable->item(0,0);
To copy to clipboard, switch view to plain text mode
But how can I get my integer out of this? This won't return integer.
Bookmarks