summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-01-19 19:40:56 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-01-24 18:50:34 +0100
commit089d54f06ff327f5212cb08fdbcb540066357dd5 (patch)
tree5dc1bfc1073e99dbe228e5858ded9202aa1066b3 /src/widgets/widgets/qcombobox.cpp
parentb5193881e54ec3f3fe496654d23584eb5f96b692 (diff)
Sync behavior and documentation of QFoo::setItemDelegate()
QComboBox::setItemDelegate() does delete the old delegate which is in constrast to all other setItemDelegate() functions which is quite confusing. Sync in by *not* deleting the delegate in QComboBox::setItemDelegate() and adjust the documentation to explicitly state that the ownership is *not* passed to the affected classes. [ChangeLog][QtWidgets][QComboBox] QComobBox::setItemDelegates no longer deletes the previous delegate set. Fixes: QTBUG-72483 Change-Id: I89c8e53903e7c9924a980c57b83ce40f5866e6ae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcombobox.cpp')
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index d786c7ff83..785de35090 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2096,6 +2096,9 @@ QAbstractItemDelegate *QComboBox::itemDelegate() const
Sets the item \a delegate for the popup list view.
The combobox takes ownership of the delegate.
+ Any existing delegate will be removed, but not deleted. QComboBox
+ does not take ownership of \a delegate.
+
\warning You should not share the same instance of a delegate between comboboxes,
widget mappers or views. Doing so can cause incorrect or unintuitive editing behavior
since each view connected to a given delegate may receive the
@@ -2110,7 +2113,6 @@ void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate)
qWarning("QComboBox::setItemDelegate: cannot set a 0 delegate");
return;
}
- delete view()->itemDelegate();
view()->setItemDelegate(delegate);
}