Add button to QTableWidget cell alongside with ent

2019-07-24 03:47发布

问题:

I have a QTableWidget and one column of it is for specifying file path. I want to provide user with two options, writing the path, or specifying it using QFileDialog. When I added a button as cell widget, it covered whole cell and the entry disappeared.

QPushButton *browseButton = new QPushButton("...", tableWidget);
tableWidget->setCellWidget(rowCount, 3, browseButton);

How can I insert QPushButton or QAction with QIcon alongside with entry?