diff options
Diffstat (limited to 'src/widgets/itemviews/qtablewidget.cpp')
-rw-r--r-- | src/widgets/itemviews/qtablewidget.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index d89fdc9000..1cb88cbeeb 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -2223,7 +2223,7 @@ void QTableWidget::editItem(QTableWidgetItem *item) /*! Opens an editor for the give \a item. The editor remains open after editing. - \sa closePersistentEditor() + \sa closePersistentEditor(), isPersistentEditorOpen() */ void QTableWidget::openPersistentEditor(QTableWidgetItem *item) { @@ -2237,7 +2237,7 @@ void QTableWidget::openPersistentEditor(QTableWidgetItem *item) /*! Closes the persistent editor for \a item. - \sa openPersistentEditor() + \sa openPersistentEditor(), isPersistentEditorOpen() */ void QTableWidget::closePersistentEditor(QTableWidgetItem *item) { @@ -2249,6 +2249,20 @@ void QTableWidget::closePersistentEditor(QTableWidgetItem *item) } /*! + \since 5.10 + + Returns whether a persistent editor is open for item \a item. + + \sa openPersistentEditor(), closePersistentEditor() +*/ +bool QTableWidget::isPersistentEditorOpen(QTableWidgetItem *item) const +{ + Q_D(const QTableWidget); + const QModelIndex index = d->tableModel()->index(item); + return QAbstractItemView::isPersistentEditorOpen(index); +} + +/*! \since 4.1 Returns the widget displayed in the cell in the given \a row and \a column. @@ -2641,14 +2655,28 @@ QList<QTableWidgetItem*> QTableWidget::items(const QMimeData *data) const /*! Returns the QModelIndex associated with the given \a item. + + \note In Qt versions prior to 5.10, this function took a non-\c{const} \a item. */ -QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const +QModelIndex QTableWidget::indexFromItem(const QTableWidgetItem *item) const { Q_D(const QTableWidget); return d->tableModel()->index(item); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +/*! + \internal + \obsolete + \overload +*/ +QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const +{ + return indexFromItem(const_cast<const QTableWidgetItem *>(item)); +} +#endif + /*! Returns a pointer to the QTableWidgetItem associated with the given \a index. */ |