我创建了一个QTableWidget
,其中包含文件名及其大小。现在,我需要从TableWidget
检索文件名,并将其存储在文件中。有人可以帮我怎么做吗?是否有任何功能可以从列中检索文本?
最佳答案
尝试使用方法
QTableWidgetItem* item(int row, int column) const
像这样使用:
int row = 1;
int col = 1;
QTableWidgetItem* theItem = theTableWidget->item(row, col);
并使用QTableWidgetItem方法提取文本
QString text () const
像这样使用:
QString theText = theItem->text();
关于visual-studio-2008 - 如何从QTableWidget获取数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8815656/