joki
joki

Reputation: 847

How to get the data from QTableWidget?

I have created a QTableWidget which contains the file name and its size. Now I need to retrieve the file name from TableWidget and need to store it in a File. Can anyone help me to how to do this?, is there any function to retrive the text from column?

Upvotes: 6

Views: 9984

Answers (1)

Kristofer
Kristofer

Reputation: 3269

Try using the method

QTableWidgetItem* item(int row, int column) const

Used like this:

int row = 1;
int col = 1;
QTableWidgetItem* theItem = theTableWidget->item(row, col);

and extract the text using QTableWidgetItem method

QString text () const

Used like this:

QString theText = theItem->text();

Upvotes: 15

Related Questions