diff options
Diffstat (limited to 'src/sql/models')
-rw-r--r-- | src/sql/models/qsqlrelationaldelegate.h | 2 | ||||
-rw-r--r-- | src/sql/models/qsqlrelationaltablemodel.cpp | 10 | ||||
-rw-r--r-- | src/sql/models/qsqltablemodel.cpp | 10 | ||||
-rw-r--r-- | src/sql/models/qsqltablemodel.h | 3 |
4 files changed, 19 insertions, 6 deletions
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index ca5c46778f..2f16a4a54b 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -58,7 +58,7 @@ QT_REQUIRE_CONFIG(sqlmodel); #include <QtCore/qmetaobject.h> QT_BEGIN_NAMESPACE - +// ### Qt6: QStyledItemDelegate class QSqlRelationalDelegate: public QItemDelegate { static int fieldIndex(const QSqlTableModel *const model, diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 1f590c4ab2..34be010474 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -626,8 +626,8 @@ QString QSqlRelationalTableModel::selectStatement() const /*! Returns a QSqlTableModel object for accessing the table for which - \a column is a foreign key, or 0 if there is no relation for the - given \a column. + \a column is a foreign key, or \nullptr if there is no relation for + the given \a column. The returned object is owned by the QSqlRelationalTableModel. @@ -636,12 +636,12 @@ QString QSqlRelationalTableModel::selectStatement() const QSqlTableModel *QSqlRelationalTableModel::relationModel(int column) const { Q_D(const QSqlRelationalTableModel); - if ( column < 0 || column >= d->relations.count()) - return 0; + if (column < 0 || column >= d->relations.count()) + return nullptr; QRelation &relation = const_cast<QSqlRelationalTableModelPrivate *>(d)->relations[column]; if (!relation.isValid()) - return 0; + return nullptr; if (!relation.model) relation.populateModel(); diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index a33f76838f..98d6ddf882 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -607,6 +607,16 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in return true; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +/*! + \reimp + */ +bool QStringListModel::clearItemData(const QModelIndex &index) +{ + return setData(index, QVariant(), Qt::EditRole); +} +#endif + /*! This function simply calls QSqlQueryModel::setQuery(\a query). You should normally not call it on a QSqlTableModel. Instead, use diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h index 7acc7dc94d..eba27e60ec 100644 --- a/src/sql/models/qsqltablemodel.h +++ b/src/sql/models/qsqltablemodel.h @@ -74,6 +74,9 @@ public: QSqlRecord record(int row) const; QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool clearItemData(const QModelIndex &index) override; +#endif QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |