如何从QTableWidget获取数据?

发布于 2024-12-26 05:58:22 字数 120 浏览 2 评论 0原文

我创建了一个 QTableWidget,其中包含文件名及其大小。现在我需要从 TableWidget 检索文件名并将其存储在文件中。任何人都可以帮助我如何做到这一点?是否有任何功能可以从列中检索文本?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人生百味 2025-01-02 05:58:22

方法

QTableWidgetItem* item(int row, int column) const

尝试使用像这样使用的

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

提取文本:

QString text () const

:并使用 QTableWidgetItem 方法像这样

QString theText = theItem->text();

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文