Itemviews/doc: add not about ownership for setItemWidget()
QListWidget/QTreeWidget::setItemWidget() take ownership of the widget. This was documented for QTreeWidget but not for QListWidget. Unify the wording with QAbstractItemView::setIndexWidget() (which gets called by setItemWidget()). Pick-to: 6.7 6.5 Change-Id: I272a20b7e7be13df1ddd9f2ba552dd9da68e2a3b Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 53c6c73c57d36796577a13fd4dd82a04ee9647ab) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
892012e5d9
commit
5b4842c992
@ -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.
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user