Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 890
joki Avatar asked Jan 11 '12 07:01

joki


1 Answers

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();
like image 50
Kristofer Avatar answered Sep 21 '22 06:09

Kristofer