如何从QTableWidget::setCellWidget()中获取文本
How to get the text from QTableWidget::setCellWidget()
我正试图弄清楚如何从setCellWidget
中获取QLabel文本。
我把我的tableWidget
设置成这样:
QLabel *nt = new QLabel();
nt->setStyleSheet("QLabel {padding-left:1px;color: white!important;display: block;float: left;border-radius: 11px;font-weight: bold!important;border: 2px solid #FFFFFF;box-shadow: 1px 1px 2px #999999;background: #d675a7;background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #f48282, stop: 1 #d00a0a);}");
nt->setText("1");
nt->setFixedWidth(22);
nt->setFixedHeight(22);
ui->tableWidget_3->setCellWidget(0,3,nt);
我正在尝试检索这样的值:
qDebug() << ui->tableWidget_3->item(0, 3)->text();
有什么想法吗?
ui->tableWidget_3->cellWidget(0, 3)->property("text").toString();
相关文章:
- 如何从QToolBox中动态创建的QLineEdit中获取文本
- C++文本文件的获取线
- 如何在QGridLayout中获取QComboBox的当前文本?
- 从两个 4x64 位整数数组中获取取模
- 如果给定了文本样式,如何获取特定文本的 QSize 对象
- 如何从第三方程序中通过鼠标悬停获取按钮文本
- 仅从qtextedit小部件中获取可见文本
- 从 XMLHttpRequest-Object 获取响应文本
- 从二进制文件中抓取文本时,为什么 xdg_vtnr=8 是我的结果
- 如何使用预处理器从源文件中获取一行文本
- 如何使用字符串操作来获取输入文本文件的某些部分
- 在MFC CListCtrl中获取项文本的索引
- 如何从CMFCEditBrowseCtrl获取路径文本
- 如何从网页中获取所有文本
- 从Windows应用程序的文本框中抓取文本
- 使用c++从活动窗口获取选定文本
- 在Cimg库中获取渲染文本的尺寸
- 将成员方法声明列表获取到文本编辑器中
- 点击QGraphicsItem获取带有文本的QRectF
- 使用libzip从.zip获取文件(文本除外)