Since Qt 6.2 QSqlQuery's copy-constructor and copy-assignment operator are deprecated.
The rational behind that is that QSqlQuery should be a move-only type.
However, we still use the deprecated methods in our APIs.
- QSqlTableModel::setQuery() takes query by constant reference.
- QSqlQueryModel::query() returns a copy of the query.
The first call should be deprecated in favor of a method that takes an rvalue ref, like it is done for QSqlQueryModel::setQuery().
The second case is more problematic. Probably the best case would be to return a pointer to the current query? With this approach the user will be able to access all the public methods of QSqlQuery. This will, however, require to provide a different name for the pointer getter, or to add an explicit parameter (because function overloads can't differ only by return type).