Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105048

QSqlQuery is supposed to be move-only, however we copy it in our code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.5.0 FF
    • 6.2.4, 6.3.1, 6.4.0 Beta2
    • SQL Support
    • None

    Description

      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.

      Specifically:

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

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-105048
          # Subject Branch Project Status CR V

          Activity

            People

              ivan.solovev Ivan Solovev
              ivan.solovev Ivan Solovev
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: