Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-23750

Create a tool to help users migrate from Qt5 to Qt6

XMLWordPrintable

    • Icon: User Story User Story
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • None
    • None

      Users/companies need good tooling to support migrating from Qt5 to Qt6. Among several options, clazy probably provides the best UX and we should study and implement the required clazy configs to analyse the code and suggest changes, required by Qt6. Python scripts have been considered as an alternative option, but instead of string replacements, clazy would provide nicer suggestions. 

      Basic fixes

      Code Replace With
      QLatin1String("str") u"str"
      QLatin1Char("c") u'c'

      Signature fixes

      Code Replace With
      uint qHash(MyType x) size_t qHash(MyType x)
      uint qHash(MyType x, uint seed) size_t qHash(MyType x, size_t seed)

      Header Fixes

      Code Replace With
      include <QtGui/QOpenGLShaderProgram> <QtOpenGL/QOpenGLShaderProgram>
      include <QtGui/qopenglshaderprogram.h> <QtOpenGL/qopenglshaderprogram.h>
      include <QtCore/QLinkedList> <Qt5Compat/QLinkedList>
      include <QtCore/qlinkedlist.h> <Qt5Compat/qlinkedlist.h>
      include <QtCore/QLinkedListData> <Qt5Compat/QLinkedListData>
      include <QtCore/QLinkedListIterator> <Qt5Compat/QLinkedListIterator>
      include <QtCore/QLinkedListNode> <Qt5Compat/QLinkedListNode>
      include <QtCore/QMutableLinkedListIterator> <Qt5Compat/QMutableLinkedListIterator>
      include <QtCore/QRegExp> <Qt5Compat/QRegExp>
      include <QtCore/qregexp.h> <Qt5Compat/qregexp.h>
      include <QtCore/QTextCodec> <Qt5Compat/QTextCodec>
      include <QtCore/qtextcodec.h> <Qt5Compat/qtextcodec.h>
      include <QtCore/QTextDecoder> <Qt5Compat/QTextDecoder>
      include <QtCore/QTextEncoder> <Qt5Compat/QTextEncoder>

      Deprecated QDir API

      Code Replace With
      Qdir dir; dir = "..."; QDir dir; dir.setPath("...");
      Qdir::addResourceSearchPath("...") QDir::addSearchPath("...")

      Deprecated QTextStream modifiers in global namespace

      Replace use of QTextStream modifiers in global namespace by their Qt:: variants, e.g.

      out << hex << i; 

      to

      out << Qt::hex << i; 

       

      (if Qt namespace is not included)

      API:
      QTextStream &bin(QTextStream &s);
      QTextStream &oct(QTextStream &s);
      QTextStream &dec(QTextStream &s);
      QTextStream &hex(QTextStream &s);
      QTextStream &showbase(QTextStream &s);
      QTextStream &forcesign(QTextStream &s);
      QTextStream &forcepoint(QTextStream &s);
      QTextStream &noshowbase(QTextStream &s);
      QTextStream &noforcesign(QTextStream &s);
      QTextStream &noforcepoint(QTextStream &s);
      QTextStream &uppercasebase(QTextStream &s);
      QTextStream &uppercasedigits(QTextStream &s);
      QTextStream &lowercasebase(QTextStream &s);
      QTextStream &lowercasedigits(QTextStream &s);
      QTextStream &fixed(QTextStream &s);
      QTextStream &scientific(QTextStream &s);
      QTextStream &left(QTextStream &s);
      QTextStream &right(QTextStream &s);
      QTextStream &center(QTextStream &s);
      QTextStream &endl(QTextStream &s);
      QTextStream &flush(QTextStream &s);
      QTextStream &reset(QTextStream &s);
      QTextStream &bom(QTextStream &s);
      QTextStream &ws(QTextStream &s);

      Removed QMap::insertMulti()

      replace

      QMap<QString, QString> m;
      m.insertMulti("foo", "bar")
      

      with

      QMultiMap<QString, QString> m;
      m.insertfoo", "bar")
      

      Changed semantics of QProcess::start("foo bar")

      replace

      QProcess p;
      p.start(stringContainingACommandWithArguments);
      

      with

      QProcess p;
      p.startCommand(stringContainingACommandWithArguments);
      

      forward declarations of QStringList (and possibly others)

      remove

      class QStringList;
      

      and add the include directive

      #include <QtCore/qcontainerfwd.h>
      

      Further candidates

      QRegEx() QRegularExpression()

      This is a rabbit hole. The APIs are quite different. Porting hints can be found in QRegularExpression's documentation.

      Other:

      • Add a fixit to missing-qobject-macro

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            lugerard Lucie Gerard
            tpyssysa Tino Pyssysalo
            Tino Pyssysalo Tino Pyssysalo
            Kai Köhne Kai Köhne
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes