Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Automated porting from Qt 4 to Qt 5

QString foo("foo");

    Qt::escape(QLatin1String("foo"));
    Qt::escape(QString("foo"));
    Qt::escape(foo);
    Qt::escape(foo.trimmed());
    Qt::escape(QString(QLatin1String("foo")).trimmed());
    Qt::escape(foo.trimmed() + foo);
    Qt::escape(foo.trimmed() + "bar");
    Qt::escape("bar" + foo.trimmed());
    Qt::escape(QString::fromLatin1("foo"));
    Qt::escape(QString::fromUtf8("foo"));

    Qt::escape(foo.trimmed().toLatin1() + "bar");
    Qt::escape(foo.trimmed().toLatin1());
    Qt::escape("bar" + foo.trimmed().toLatin1());
    Qt::escape("foo");
    Qt::escape(foo.trimmed().toLatin1().constData());
QString(QLatin1String("foo")).toHtmlEscaped();
    QString("foo").toHtmlEscaped();
    foo.toHtmlEscaped();
    foo.trimmed().toHtmlEscaped();
    QString(QLatin1String("foo")).trimmed().toHtmlEscaped();
    QString(foo.trimmed() + foo).toHtmlEscaped();
    QString(foo.trimmed() + "bar").toHtmlEscaped();
    QString("bar" + foo.trimmed()).toHtmlEscaped();
    QString::fromLatin1("foo").toHtmlEscaped();
    QString::fromUtf8("foo").toHtmlEscaped();

    QString(foo.trimmed().toLatin1() + "bar").toHtmlEscaped();
    QString(foo.trimmed().toLatin1()).toHtmlEscaped();
    QString("bar" + foo.trimmed().toLatin1()).toHtmlEscaped();
    QString("foo").toHtmlEscaped();
    QString(foo.trimmed().toLatin1().constData()).toHtmlEscaped();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    Qt::escape(QLatin1String("foo"));
  #else
    QString(QLatin1String("foo")).toHtmlEscaped();
  #endif
Qt::escape(Qt::escape(foo));
const char *sigName = mm.methodSignature();
const QByteArray sigName = mm.methodSignature();
{
    const char *methodName = mm.signature();
    QString s = mm.signature();
    QByteArray ba = mm.signature();
  }
  {
    const char *methodName;
    QString s;
    QByteArray ba;
    methodName = mm.signature();
    s = mm.signature();
    ba = mm.signature();
  }
  charStarAPI(mm.signature());
  stringAPI(mm.signature());
  byteArrayAPI(mm.signature());
{
    const char *methodName = mm.signature();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    QString s = mm.signature();
#else
    QString s = mm.methodSignature();
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    QByteArray ba = mm.signature();
#else
    QByteArray ba = mm.methodSignature();
#endif
  }
  {
    const char *methodName;
    QString s;
    QByteArray ba;
    methodName = mm.signature();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    s = mm.signature();
#else
    s = mm.methodSignature();
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    ba = mm.signature();
#else
    ba = mm.methodSignature();
#endif
  }
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
  charStarAPI(mm.signature());
#else
  charStarAPI(mm.methodSignature());
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
  stringAPI(mm.signature());
#else
  stringAPI(mm.methodSignature());
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
  byteArrayAPI(mm.signature());
#else
  byteArrayAPI(mm.methodSignature());
#endif
class Foo
  {
  public:
    // Old API:
    virtual void m1() {}
    void m2() {}
    void m3() {}
    virtual void m5() {}

    // Replacement API:
    virtual void n1() {}
    void n2() {}
    void n3() {}
    virtual void n5() {}
  };

  class Bar : public Foo
  {
  public:
    // Old API:
    void m1() {}
    void m2() {}
    void m4() {}

    // Replacement API:
    void n1() {}
    void n2() {}
    void n4() {}
  };
Bar i;

    i.m2();

    Foo d = i;
    d.m2();
Bar i;

    i.n2();

    Foo d;
    d.m2();
namespace QSsl {
    enum SslProtocol {
      TlsV1_0,
  #if QT_NO_DEPRECATED
      TlsV1 = TlsV1_0,
  #endif
      TlsV3,
    };
  }
int i = QSsl::TlsV1;
class MyView : public QAbstractItemView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&);
  };

  class MyView2 : public QAbstractItemView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&)
    {
      // inline implementation
    }
  };

  class MyView3 : public NotAView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&);
  };

  void MyView::dataChanged(const QModelIndex&,
                           const QModelIndex&)
  {
  }

  void MyView3::dataChanged(const QModelIndex&,
                            const QModelIndex&)
  {
  }
class MyView : public QAbstractItemView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&,
                     const QVector<int>& = QVector<int>());
  };

  class MyView2 : public QAbstractItemView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&,
                     const QVector&<int> = QVector<int>())
    {
      // inline implementation
    }
  };

  class MyView3 : public NotAView
  {
  public:
    void dataChanged(const QModelIndex&,
                     const QModelIndex&);
  };

  void MyView::dataChanged(const QModelIndex&,
                           const QModelIndex&,
                           const QVector<int>&)
  {
  }

  void MyView3::dataChanged(const QModelIndex&,
                            const QModelIndex&)
  {
  }
image.text( "Thumb::URI", 0 );
image.text( "Thumb::URI" );

6 Comments

18 - Jun - 2012

Karellen

18 - Jun - 2012

steveire

18 - Jun - 2012

Manuel Klimek

23 - Dec - 2013

musicoterapia

11 - Feb - 2014

jan

18 - Jun - 2014

Leonardo Luduena