【问题标题】:How to insert spinBox in TableWidget's cell in Qt? [closed]如何在 Qt 的 TableWidget 的单元格中插入 spinBox? [关闭]
【发布时间】:2017-04-16 16:51:09
【问题描述】:

请举例说明我应该怎么做。我是Qt的新手

【问题讨论】:

    标签: c++ qt


    【解决方案1】:

    根据documentation

    void QTableWidget::setCellWidget(int row, int column, QWidget * 小部件)

    将给定的小部件设置为显示在给定行的单元格中,并且 列,将小部件的所有权传递给表。

    如果将单元格小部件 A 替换为单元格小部件 B,则单元格小部件 A 将 删除。例如,在下面的代码 sn-p 中,QLineEdit 对象 将被删除。

    例子:

    tableWidget->setCellWidget(row, col, new QSpinBox);
    

    【讨论】:

      猜你喜欢
      • 2020-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多