QTreeWidget: fix const-incorrectness in indexFromItem() parameters
The item to look up isn't modified, so take by pointer-to-const. Can't change the API, so overload and mark the old function for removal in Qt 6. Change-Id: I4671c6b079687ec9d81b1ac0e6745887ef7077cd Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
1d03ed3f2b
commit
b2aeeaf628
@ -3342,14 +3342,25 @@ QList<QTreeWidgetItem*> QTreeWidget::items(const QMimeData *data) const
|
|||||||
/*!
|
/*!
|
||||||
Returns the QModelIndex assocated with the given \a item in the given \a column.
|
Returns the QModelIndex assocated with the given \a item in the given \a column.
|
||||||
|
|
||||||
|
\note In Qt versions prior to 5.7, this function took a non-\c{const} \a item.
|
||||||
|
|
||||||
\sa itemFromIndex(), topLevelItem()
|
\sa itemFromIndex(), topLevelItem()
|
||||||
*/
|
*/
|
||||||
QModelIndex QTreeWidget::indexFromItem(QTreeWidgetItem *item, int column) const
|
QModelIndex QTreeWidget::indexFromItem(const QTreeWidgetItem *item, int column) const
|
||||||
{
|
{
|
||||||
Q_D(const QTreeWidget);
|
Q_D(const QTreeWidget);
|
||||||
return d->index(item, column);
|
return d->index(item, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\overload
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
QModelIndex QTreeWidget::indexFromItem(QTreeWidgetItem *item, int column) const
|
||||||
|
{
|
||||||
|
return indexFromItem(const_cast<const QTreeWidgetItem *>(item), column);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a pointer to the QTreeWidgetItem assocated with the given \a index.
|
Returns a pointer to the QTreeWidgetItem assocated with the given \a index.
|
||||||
|
|
||||||
|
@ -350,7 +350,8 @@ protected:
|
|||||||
virtual Qt::DropActions supportedDropActions() const;
|
virtual Qt::DropActions supportedDropActions() const;
|
||||||
QList<QTreeWidgetItem*> items(const QMimeData *data) const;
|
QList<QTreeWidgetItem*> items(const QMimeData *data) const;
|
||||||
|
|
||||||
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const;
|
QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const;
|
||||||
|
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove
|
||||||
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
|
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user