Details
-
Suggestion
-
Resolution: Unresolved
-
P5: Not important
-
None
-
None
-
None
Description
Hi,
Imagine this usecase. You have a model with an x number of columns. One (or more) of these columns need to be a widget. For instance a QPushButton. It's not a really exotic usecase and i've been through that case a couple of times. The way this is currently possible in views (say QTableView) is really non-intuitive and requires a lot of boiler plate code. That in turn makes it very error prone and difficult to develop.
Qt's delegate options for this aren't suffice. The only one provided by Qt is QAbstractItemDelegate and that doesn't help showing a widget. Others that are possible (but require a lot of code to work with any widget) are QItemDelegate and (if you want to code even more) QAbstractItemDelegate.
I'd like to request a delegate that easily allows you to show any widget including it's interaction (say mouse hovers and clicks on a QPushButton) to be provided by Qt with minimal code. For reference, see the far from trivial star delegate from Qt itself: http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html
This new delegate (lets call it QWidgetDelegate) is going to pose a bit of a challenge. For instance, how would you bind the clicked or pressed or any signals from - for example - QPushButton to an action defined by the user.
Thanks,
Mark
Attachments
Issue Links
- is duplicated by
-
QTBUG-59314 Add a "QWidgetDelegate" to allow injecting widgets into a view
- Closed