Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
None
-
5.9.4, 5.10.1
Description
"Note: Since Qt 4.2 the item delegates query the user property of widgets, and only call this function if the widget has no user property. You can override this behavior by reimplementing QAbstractItemDelegate::setModelData() and QAbstractItemDelegate::setEditorData()." ( http://doc.qt.io/qt-5/qitemeditorcreatorbase.html#valuePropertyName )
"If the editor widget has no user property defined, the delegate asks the factory for the property name, which it in turn asks the item editor creator for." ( http://doc.qt.io/qt-5/qtwidgets-itemviews-coloreditorfactory-example.html#further-customization-of-item-view-editors )
PROBLEM: The part "delegate asks the factory for the property name" is not true for QStyledItemDelegate::setEditorData nor QItemDelegate::setEditorData. If the editor doesn't have a USER property, these functions do nothing.
On the other hand the documentation of QStyledItemDelegate states "The default implementation stores the data in the editor widget's user property." ( http://doc.qt.io/qt-5/qstyleditemdelegate.html#setEditorData )
How should one interpret these?
- Is this a bug in the code, or
- a bug in the documentation, or
- is there an implicit requirement to subclass QStyledItemDelegate and re-implement setEditorData() to get the delegate to work with editors that don't have a USER property?
(In contrast to setEditorData(), QStyledItemDelegate::setModelData() asks for the property name, even though its documentation states "The default implementation gets the value to be stored in the data model from the editor widget's user property.")