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