Details
Description
I'm not sure that 'Bug' is the most fitting issue type. I was advised to submit per this qt forum post: https://forum.qt.io/topic/146598/deprecationwarning-qsqlquerymodel-setquery
I am trying to set a QSqlQueryModel to a QSqlQuery object. I'm using a query object rather than a string because I need the query to be parameterized, I need to prepare and bind values to the query. Here is example code:
def requery(self, parent_id): q = QSqlQuery() q.prepare(""" SELECT id, some_field, parent_id FROM child_table WHERE parent_id=? """) q.addBindValue(parent_id) q.exec() self._model.setQuery(q)
Doing so produces the following warning:
DeprecationWarning: Function: 'QSqlQueryModel.setQuery(const QSqlQuery & query)' is marked as deprecated, please check the documentation for more information.
Attachments
Issue Links
- relates to
-
QTBUG-91766 Changing copy of QSqlQuery changes original.
- Closed
For Gerrit Dashboard: PYSIDE-2394 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
493449,2 | Use QSqlQueryModel::setQuery(QSqlQuery &&) | dev | pyside/pyside-setup | Status: NEW | 0 | 0 |
492630,2 | shiboken6: Make it possible to override a C++ deprecation attribute | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
492631,2 | PySide6: Undeprecate QSqlQueryModel::setQuery(const QSqlQuery &) in Qt 6 | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
492680,2 | shiboken6: Make it possible to override a C++ deprecation attribute | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
492701,2 | PySide6: Undeprecate QSqlQueryModel::setQuery(const QSqlQuery &) in Qt 6 | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
492826,10 | Add experimental support for rvalue references | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |