diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 695f1c8c7f5..98ba2533d64 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -3285,7 +3285,8 @@ bool QAbstractItemView::isPersistentEditorOpen(const QModelIndex &index) const to true, otherwise the widget's background will be transparent, showing both the model data and the item at the given \a index. - If index widget A is replaced with index widget B, index widget A will be + \note The view takes ownership of the \a widget. + This means if index widget A is replaced with index widget B, index widget A will be deleted. For example, in the code snippet below, the QLineEdit object will be deleted. diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index a91902813a9..146c2b42f5e 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1713,6 +1713,8 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const implement a custom editor widget, use QListView and subclass QStyledItemDelegate instead. + \note The list takes ownership of the \a widget. + \sa itemWidget(), removeItemWidget(), {Delegate Classes} */ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget) diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 8e46a0efbe1..a176ef4c8e9 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2567,6 +2567,8 @@ void QTreeWidgetPrivate::dataChanged(const QModelIndex &topLeft, \fn void QTreeWidget::removeItemWidget(QTreeWidgetItem *item, int column) Removes the widget set in the given \a item in the given \a column. + + \sa itemWidget(), setItemWidget() */ /*! @@ -3016,6 +3018,7 @@ bool QTreeWidget::isPersistentEditorOpen(QTreeWidgetItem *item, int column) cons Returns the widget displayed in the cell specified by \a item and the given \a column. + \sa setItemWidget(), removeItemWidget() */ QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const { @@ -3042,9 +3045,9 @@ QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const i.e., the QTreeWidgetItem that will hold \a widget must have been added to the view before \a widget is set. - \note The tree takes ownership of the widget. + \note The tree takes ownership of \a widget. - \sa {Delegate Classes} + \sa itemWidget(), removeItemWidget(), {Delegate Classes} */ void QTreeWidget::setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget) {