I'm using QComboBox
to select unit (an arbitrary property of the object) from Units table. The problem is that object in my data model can have no unit (NULL in the table), in which case QComboBox
shows value happened on top of the list. Select 'none' is not possible.
What do you suggest to add NULL support? I have few versions:
- Insert special record in Units table named '--' or 'N/A'. Not exactly NULL - will have its own id.
- Set items in
QComboBox
and update model manually. Possible but tedious - goodbye automatic update of unit list.
What else is possible - subclassing QComboBox
(overriding what)? I don't see anything similar to setEditorData
/setModelData
like in QAbstractItemDelegate
to control items.