Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Customizing QComboBox dropdown
krzysieklfc last edited by
I want QComboBox dropdown to contain a special 'Create new' option just like in the image below. My ComboBox view is a custom QTableView, not a simple list.
I'm not very familiar with lower-level drawing APIs and I would like to pick the right tool for the job right from the start.
Any recommended approach I should take to implement this?
QStyledItemDelegate comes to mind for that.
krzysieklfc last edited by krzysieklfc
@SGaist Thanks for responding.
While drawing seems pretty straightforward, how do I correctly extend the viewport boundaries so the new drawn rectangle is visible? I can't find an example of how to do that.
Is it all doable in QStyledItemDelegate or do I need to play with sizeHint etc.?
There might be several ways. You could implement a custom view which paints in a larger view port.
Or have that last item be a normal item and react on it when clicked.