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.
- 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 |