Qt - QTableView - Clickable button in table row

后端 未结 2 1704
庸人自扰
庸人自扰 2020-12-30 00:06

I require a button/link within a table row of a QTableView. This is to open a dialog to allow that row to be edited more efficiently.

After hours of loo

2条回答
  •  感情败类
    2020-12-30 00:39

    You can use setIndexWidget for that, see the Qt documentation for more information.

    As an example, to embed a push button in the first column of the second row (untested code):

    tableView->setIndexWidget(tableView->model()->index(2, 1), new QPushButton);
    

提交回复
热议问题