I want-to put-a customed-widget into the cell of QTableView
. The Widget can-be a QPushButton
, a checkBox or something else. I've tried following methods, but no-one satisfies me:
QTableView::setIndexWidget()
. Using this strategy, the customed-widget covers the cell wholly & absolutely, delegate binded to QTableView
not working, which means a-double-click() wont make Edit operation on-the cell.Note that the function is stand-alone, like a plugin. So I cant do following things.
QTableView
. I can only get a-pointer-variable binded with QTableView
----only an object of QTableView
.The problem is really complex and too-many constraints restrict the design.
Thanks for all of you contributing to this question, I've found a way to solve this problem. It is solved as the "original thought", which is just to draw a QToolButton on the tableView, using the QModelIndex. Through QModelIndex, I can get the geomertry location where I can draw any QWidget. However, this method is really complex, for I have to maintain the changes of QModelIndex, like removeColumns and insertColumns.
Another problem is concerned that I have to distinguish between hide & delete columns or rows. And I think I should post an another new question for help. Thanks again.