**Note: This is going to be an incredibly long article regarding many details about porting applications from Harmattan to Sailfish. so if you’re not an application developer or perhaps not interested in being one in the future and don’t want to learn about Qt, Walk away before you get bored and kindly wait for our next more reader-friendly article! 😉

Ahoy!

Ever thought of porting your already developed applications for MeeGo-Harmattan?

Well if you have, you might have been trying as well. Getting a hang of it pretty easy as you carry on trying, but fortunately for futuristic developers, there has been an update regarding the Sailfish OS’s SDK which is named Alpha-Qt5 and as your attention may have been gathered to the name of it, it is now supporting Qt5 instead of the usual 4.8 which is better in many ways (Based on a video created by QtStudios) :

OpenGL-based scene graph for Qt Quick 2.0 – Providing velvet animations, particles and impressive graphical effects

Multimedia – Audio, Video and Camera support on all major platforms

WebKit – Full HTML 5 support from the world’s most popular web engine

C++ language features – Template-based connect(), C++ 11 support

Connectivity and Networking – DNS lookup, Improved IPv6 Support

JSON support – Fast parser and writer, binary format support

Modularization of the Qt libraries – sanitizing our codebase and simplifying deploymant

Qt platform abstraction – Unifying the Qt codebase across platforms, minimizing the porting effort for the new platforms

Wayland support – Wayland compatible Qt backend and compositor framework

The Qt widgets work better than ever with accessibility improvements and better display supports

So on and so forth. So in this particular case, developers might want to learn how to transfer and port everything from Qt4 to Qt5, X11 to Wayland and Quick Qt 1.0 to Quick Qt 2.0 .

Firstly; you should know the similarities and differences between Harmattan and Sailfish, as a developer’s point of view (Taken from sailfoshos.org

Secondly, you might want to know a summarize of the changes happened in Qt5 which is a handy piece of points gathered by me from qt-project.org without any changes :

Modularized codebase – This means only Qt essentials and the add-on modules you’re interested in are needed to develop an application. To know what makes the essentials and add-on modules, refer to the modules page.

Platform-specific code – Symbian and Meego-specific code is removed from the codebase.

Platform defines – All platform-specific code must be wrapped using the preprocessor macro, Q_OS_* instead of Q_WS_* .

instead of . Qt Widgets – These are now part of a separate module, QtWidgets. They were part of QtGui earlier.

Qt Quick – The older Qt Quick version (1.0) is now part of a separate Qt Declarative add-on module for compatibility purposes. We recommend using the new Qt Quick (2.0) from now on to avoid binary breaks in the future.

Qt3Support – This module is removed in Qt 5, so you must move away from this module before porting your codebase to Qt 5.

Qt WebKit – This module has been split into two, there is now a Qt WebKit and a Qt WebKit Widgets module.

Multimedia – In Qt 5, multimedia support is provided by the Qt Multimedia module. Phonon framework is no longer part of Qt, but it continues to be maintained by the Phonon developers and has support for Qt 5. See http://phonon.kde.org.

Oh God…! This is getting a lot more technical than I thought it would get. Now there are C++ API changes which will be handy if your app is written in C++. If you are a dev, you are able to find the full list of these changes in <Qt 5 Install Dir>/qtbase/dist/changes-5.0.0 .

But anyhow, I’m going to put a rather long yet brief list of the changes to the Qt Core, Qt GUI, Qt Widgets Qt Webkit, Qt Print Support, Qt Network, Qt SQL, Qt Test, Qt Global and Tools all gathered from qt-project.org again!

Changes to the Qt Core:

The QObject::connectNotify() and QObject::disconnectNotify() functions now need a QMetaMethod argument that identifies the signal, rather than a const char pointer.

pointer. QLibrary::resolve() now returns a function pointer instead of void pointer.

pointer. QLibraryInfo::buildKey() and the corresponding QT_BUILD_KEY macro are removed. You must remove all references to this function and macro, as build key is not necessary now.

and the corresponding macro are removed. You must remove all references to this function and macro, as build key is not necessary now. QCoreApplication::translate() no longer returns the source text if the translation is empty. Use the Qt Linguist Release tool ( lrelease -removeidentical ) instead for optimization.

) instead for optimization. The QTranslator::translate() function signature is changed to set the default value of n to -1. We recommend you to update the implementation of this virtual function in your sources.

to -1. We recommend you to update the implementation of this virtual function in your sources. QString and QByteArray constructors now use a negative size to indicate that the string passed is null-terminated (a null-terminated array of QChar, in the case of QString). In Qt 4, negative sizes were ignored, which resulted in empty QStringand QByteArray. The size argument now has a default value of -1, replacing the separate constructors that did the same.

QBool is removed. In Qt 4, QString::contains, QByteArray::contains, and QList::contains returns an internal QBool type so that the Qt3 code “if (a.contains() == 2)” would not compile anymore. If your code uses QBool , replace it with bool .

QMetaType has undergone the following changes: QMetaType::construct is renamed as QMetaType::create. QMetaType::unregisterType() is removed. QMetaType now records whether the type argument inherits QObject. Such information can be useful for scripting APIs, so that custom QObject subclasses are treated as QObject pointers. For example, in QtScript this means QScriptValue.isQObject can be true, where it was false before. QMetaType::QWidgetStar is removed. Use qMetaTypeId<QWidget*>() or QVariant::canConvert<QWidget*>() instead. Q_DECLARE_METATYPE(type) now requires type to be fully defined. This means, Q_DECLARE_METATYPE(QSharedPointer<t>) and Q_DECLARE_METATYPE(QWeakPointer<t>) also need type to be fully defined. In cases where a forward declared type is needed as a meta-type, use Q_DECLARE_OPAQUE_POINTER(type) .

QMetaMethod has undergone the following changes: QMetaMethod::signature() is renamed as QMetaMethod::methodSignature, and the return type is changed toQByteArray. This change is to enable generating the signature string on demand, rather than storing it in the meta-data. QMetaMethod::typeName no longer returns an empty string if the return type is void , instead it returns "void" . The recommended way of checking whether a method returns void is to compare the return value of QMetaMethod::returnType with QMetaType::Void.

The QVariant constructor which takes Qt::GlobalColor argument is removed. Code constructing such variants must explicitly call QColor constructor now. For example, instead of "QVariant(Qt::red)" , use "QVariant(QColor(Qt::red))" to create a QVariant instance.

QAbstractEventDispatcher has undergone the following changes: The signature for the pure-virtual registerTimer() function is changed. All subclasses of QAbstractEventDispatchermust re-implement the function with this new signature: virtual void registerTimer(int timerId, int interval,Qt::TimerType timerType, QObject *object) = 0; QAbstractEventDispatcher::TimerInfo is no longer a typedef of QPair<int, int> . It is now a struct with 3 members: int timerId , int interval , and Qt::TimerType timerType . Update the QAbstractEventDispatcher::registeredTimers function with this change.



The QUuid::operator QString() implicit conversion operator is removed. Use the QUuid::toString() function instead.

implicit conversion operator is removed. Use the QUuid::toString() function instead.

QProcess::ForwardedChannels no longer forwards the output to the GUI applications on the Windows platform, unless those applications creates a console.



QDir has undergone the following changes: The convertSeparators() function is removed. Use QDir::toNativeSeparators() instead. The QDir::NoDotAndDotDot enum value is removed. Use QDir::NoDot or QDir::NoDotDot instead. QTextCodecPlugin is removed as all the text codecs are part of Qt Core now. QFSFileEngine , QAbstractFileEngine , QAbstractFileEngineIterator , and QAbstractFileEngineHandler are no longer public. We recommend you to avoid using these classes as there is no compatibility promise. The QLocale::toShort(), QLocale::toUShort(), QLocale::toInt(), QLocale::toUInt(), QLocale::toLongLong(), andQLocale::toULongLong() functions no longer take the argument for base. They localize base 10 conversions. To convert other bases, use the QString functions instead. QSystemLocale is not public anymore. Use QLocale instead. The QChar::NoCategory enum value is removed. The QChar::Other_NotAssigned enum value is returned for unassigned codepoints now. QAbstractItemModel has undergone the following changes: beginMoveRows() no longer emits the layoutAboutToBeChanged signal, and endMoveRows() no longer emits the layoutChanged signal. All proxy models must connect to (and disconnect from) the rowsAboutToBeMoved and rowsMoved signals. QAbstractItemModel::sibling is virtual now to allow implementations to optimize based on internal data. QAbstractItemModel::createIndex method now only provides the void* and quintptr overloads, making calls with a literal 0 (createIndex(row, col, 0)) ambiguous. Either cast (quintptr(0)) or omit the third argument(to get the void* overload).

Default value of the QSortFilterProxyModel::dynamicSortFilter property is changed to true . QString::mid, QString::midRef, and QByteArray::mid now return an empty QString , QStringRef , and QByteArray respectively, if the position passed is equal to the length (that is, right after the last character/byte). In Qt 4, they use to return a null QString or a null QStringRef . The following QString functions use the C locale instead of the default or system locale: toLongLong() toULongLong() toLong() toULong() toInt() toUInt() toShort() toUShort() toDouble() toFloat() This is to guarantee consistent default conversion of strings. For locale-aware conversions use the equivalentQLocale functions.



QDate, QTime, and QDateTime has undergone the following important behavioral changes: QDate only implements the Gregorian calendar, and the switch to the Julian calendar before 1582 has been removed. This means all QDate functions return different results for dates prior to 15 October 1582, and there is no longer a gap between 4 October 1582 and 15 October 1582. QDate::setYMD() is deprecated, use QDate::setDate() instead. Adding days to a null QDate or seconds to a null QTime will no longer return a valid QDate/QTime. The QDate::addDays() and QDateTime::addDays() functions now takes a qint64 argument, and theQDate::daysTo() and QDateTime::daysTo() functions now returns a qint64 value.

QTextCodec has undergone the following changes: QTextCodec::codecForCStrings() and QTextCodec::setCodecForCStrings() are removed as they were creating uncertainty/bugs in using QString easily and (to a lesser extent) performance issues. QTextCodec::codecForTr() and QTextCodec::setCodecForTr() are removed.

QObject::trUtf8 and QCoreApplication::Encoding enums are deprecated. Qt assumes that the source code is encoded in UTF-8.

enums are deprecated. Qt assumes that the source code is encoded in UTF-8. QFile::setEncodingFunction() and QFile::setDecodingFunction() are deprecated. The QFile::encodeName and QFile::decodeName are now hard-coded to operate on QString::fromLocal8Bit and QString::toLocal8Bit only. The old behavior is still possible using QTextCodec::setCodecForLocale, but it is recommended that the new code should not make assumptions about the file system encoding and older code should remove such assumptions.

and are now hard-coded to operate on QString::fromLocal8Bit and QString::toLocal8Bit only. The old behavior is still possible using QTextCodec::setCodecForLocale, but it is recommended that the new code should not make assumptions about the file system encoding and older code should remove such assumptions. QEvent::AccessibilityPrepare , {QEvent::AccessibilityHelp}, and QEvent::AccessibilityDescription are removed.

The QCoreApplication::setEventFilter and the QApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilter are replaced with QCoreApplication::installNativeEventFilter and QCoreApplication::removeNativeEventFilter for an API much closer to QEvent filtering. Note: The native events that can be filtered this way depend on the QPA backend chosen at runtime. On X11, XEvents are replaced with xcb_generic_event_t due to the switch to XCB, which requires porting the application code to XCB as well.

and the are replaced with QCoreApplication::installNativeEventFilter and QCoreApplication::removeNativeEventFilter for an API much closer to QEvent filtering. The native events that can be filtered this way depend on the QPA backend chosen at runtime. On X11, XEvents are replaced with due to the switch to XCB, which requires porting the application code to XCB as well. Qt::qDebug(), Qt::qWarning(), Qt::qCritical(), and Qt::qFatal() are changed to macros now to track the origin of the message in source code. The information to be printed can be configured (for the default message handler) by setting the new QT_MESSAGE_PATTERN environment variable. Qt::qInstallMsgHandler() is deprecated, so we recommend using Qt::qInstallMessageHandler() instead.

environment variable. Qt::qInstallMsgHandler() is deprecated, so we recommend using Qt::qInstallMessageHandler() instead. QPointer is changed to use QWeakPointer. The old guard mechanism has been removed, which causes a slight change in behavior when using QPointer. In earlier Qt version, if a QPointer is used on a QWidget (or a subclass of QWidget), theQPointer was cleared by the QWidget destructor. In Qt 5, the QPointer is cleared by the QObject destructor along with the QWeakPointers. Any QPointers tracking a widget is not cleared before the QWidget destructor destroys the children for the widget being tracked.

QUrl has been changed to operate only on percent-encoded forms. Fully-decoded forms where the percent character stands for itself, can no longer be encoded, as the getters and setters with “encoded” in the name are deprecated (except QUrl::toEncoded() and QUrl::fromEncoded()).The most notable difference with this change is when dealing with QUrl::toString. In earlier Qt version, this function would return percent characters in the URL, but now it returns “%25” like the QUrl::toEncoded does.

QUrl no longer has functions that handle individual query items and query delimiters, such as addQueryItem() and queryPairDelimiter() . These have been moved to the new QUrlQuery class.

and . These have been moved to the new QUrlQuery class. Qt::WFlags is deprecated, use Qt::WindowFlags instead. This typedef dates from the Qt 1 days, and such abbreviations are not current Qt style.

Changes to the GUI

QPainter does not support uniting clipped regions anymore. Use QRegion::united() instead to unite clips and pass the result to QPainter.

QPen now has a default width of 1 instead of 0. Thus, it is no longer cosmetic by default.

QAccessibleInterface has undergone the following changes: The “child” integer parameters are removed to bring it more closer to IAccessible2 , and this means the following functions lose the integer parameter: text(Text t, int child) is now text(Text t) rect(int child) is now rect() setText(Text t, int child, const QString &text) is now setText(Text t, const QString &text) role(int child) is now role() state(int child) is now state() navigate() is replaced with parent() and child() to navigate the hierarchy. relationTo() is replaced with relations(). QAccessibleInterface::userActionCount() , QAccessibleInterface::actionText() , and QAccessibleInterface::doAction() are removed. We recommend the QAccessibleInterface subclasses to implement the QAccessibleActionInterface instead.

The constructor of QAccessibleEvent does not need the child parameter anymore, and the corresponding QAccessibleEvent::child() function is removed.

parameter anymore, and the corresponding function is removed. The constructor of QTabletEvent does not need the hiResGlobalPos argument anymore, as all coordinates are floating point-based now.

QTouchEvent has undergone the following changes: The DeviceType enum and QTouchEvent::deviceType {deviceType()} function are deprecated as QTouchDeviceprovides a better way to identify and access the device from which the events originate. The constructor now takes a QTouchDevice pointer instead of DeviceType value. QTouchEvent::TouchPoint::isPrimary() is removed. QWidget *widget() is replaced with QObject *target() to avoid QWidget dependencies. QEvent::TouchCancel is introduced to use it on systems where it makes sense to differentiate between a regularQEvent::TouchEnd and abrupt touch sequence cancellations caused by the compositor. For example, when a swype gesture is recognized.

QIconEngineV2 is now merged into QIconEngine. Update your sources to use QIconEngine instead of QIconEngineV2 .

is now merged into QIconEngine. Update your sources to use instead of . QSound is moved to Qt Multimedia from Qt GUI.

QImage::fill() on an image with format Format_RGB888 now expects image data in RGB layout as opposed to BGR layout. This is to ensure consistency with RGB32 and other 32-bit formats.

now expects image data in RGB layout as opposed to BGR layout. This is to ensure consistency with RGB32 and other 32-bit formats. QDesktopServices::storageLocation() and QDesktopServices::displayName() are replaced by QStandardPaths::storageLocation() and QStandardPaths::displayName() respectively. They are now in the Qt Coremodule.

and are replaced by QStandardPaths::storageLocation() and QStandardPaths::displayName() respectively. They are now in the Qt Coremodule. QPixmap::grabWindow() and QPixmap::grabWidget() are removed. Use QScreen::grabWindow() instead.

Changes to the Qt Widget

The signatures of QItemEditorFactory::createEditor and QItemEditorFactory::valuePropertyName are changed to take arguments of type int instead of QVariant::Type.

instead of QVariant::Type. QInputContext is removed as related getter and setter functions in QWidget and QApplication are removed. Input contexts are now platform-specific.

is removed as related getter and setter functions in QWidget and QApplication are removed. Input contexts are now platform-specific. QApplication::setGraphicsSystem() is removed as the introduction of QPA made it redundant.

is removed as the introduction of QPA made it redundant. QInputDialog::getInteger() is deprecated. Use QInputDialog::getInt() instead.

QStyle::standardIconImplementation() and QStyle::layoutSpacingImplementation() are removed, and theQStyle::standardIcon() and QStyle::layoutSpacing() functions are made pure virtual now. The removed functions were introduced in Qt 4 for binary compatibility reasons.

and are removed, and theQStyle::standardIcon() and QStyle::layoutSpacing() functions are made pure virtual now. The removed functions were introduced in Qt 4 for binary compatibility reasons. The QStyleOption*V{2,3,4} classes are removed, and their members are merged with the respective base classes. The removed classes are left as typedefs for binary compatibility.

classes are removed, and their members are merged with the respective base classes. The removed classes are left as typedefs for binary compatibility. The following functions of QHeaderView are deprecated: void setMovable(bool movable) – Use QHeaderView::setSectionsMovable instead. bool isMovable() const – Use QHeaderView::sectionsMovable instead. void setClickable(bool clickable) – Use QHeaderView::setSectionsClickable instead. bool isClickable() const – Use QHeaderView::sectionsClickable instead. void setResizeMode(int logicalindex, ResizeMode mode) – Use QHeaderView::setSectionResizeMode instead. * ResizeMode resizeMode(int logicalindex) const – Use QHeaderView::sectionResizeMode instead.

QGraphicsItem and its derived classes can no longer pass a QGraphicsScene to the item’s constructor. Construct the item without a scene and call QGraphicsScene::addItem to add the item to the scene.

QAbstractItemView has undergone the following changes: The derived classes now emit the clicked() signal on the left mouse click only, instead of all mouse clicks. The virtual QAbstractItemView::dataChanged function signature now includes the roles that has changed. The signature is consistent with the dataChanged signal in the model.

QProxyModel is removed. Use QAbstractProxyModel and the related classes instead. A copy of QProxyModel is available in the Ui Helpers repository.

is removed. Use QAbstractProxyModel and the related classes instead. A copy of is available in the Ui Helpers repository. QColorDialog::customColor() now returns a QColor value instead of QRgb .

. The QColorDialog::setCustomColor() and QColorDialog::setStandardColor() functions now need a QColor value as their second parameter instead of QRgb .

Changes to Qt WebKit

The WebKit module in Qt is now split in two modules, webkit and webkitwidgets , in order to allow the dependency of the widgets module to be optional. The benefits will only be profitable once the QQuickWebView API are made public through C++ in a future version. The webkitwidgets module adds the webkit module automatically to the project, so in your application’s project file, QT += webkit should now be modified to: QT += webkitwidgets

and , in order to allow the dependency of the module to be optional. The benefits will only be profitable once the QQuickWebView API are made public through C++ in a future version. The module adds the module automatically to the project, so in your application’s project file, should now be modified to: The same applies to the module include, #include <QtWebKit/QtWebKit> should be modified to: #include <QtWebKitWidgets/QtWebKitWidgets>

should be modified to: A consequence of the module split is that classes of the QtWebKit API aren’t all in the new module, so for a better compatibility of your application with both Qt4 and Qt5, #include <QtWebKit/QWebPage>, for example, should be included directly as: #include <QWebPage> The include path will take care of selecting the right module.

The qwebkitversion.h header has been renamed to qtwebkitversion.h to match other Qt modules, and part of its contents has been moved to qwebkitglobal.h. #include <qwebkitversion.h> should be replaced with two includes: #include <qtwebkitversion.h> #include <qwebkitglobal.h>

Changes to Qt Print Support

The QPageSetupDialog::PageSetupDialogOption enum and the corresponding set and get functions, QPageSetupDialog::options() and QPageSetupDialog::setOptions() are removed.

and are removed. Support for printing PostScript files has been removed.

Changes to Qt Network Anyone?

The QSslCertificate::subjectInfo() and QSslCertificate::issuerInfo() functions now return QStringList instead of a QString. This change makes searching the required information a lot easier than scanning a long string.

QSslCertificate::isValid() is deprecated. Use QSslCertificate::isBlacklisted() instead to avoid binary breaks in the future.

QSslCertificate::alternateSubjectNames() is deprecated. Use QSslCertificate::subjectAlternativeNames() instead.

The QSsl::TlsV1 enum value is renamed as QSsl::TlsV1_0.

enum value is renamed as QSsl::TlsV1_0. The QFtp , QUrlInfo , QHttp classes are not public anymore. Use QNetworkAccessManager instead to avoid binary breaks in the future. Programs that require raw FTP/HTTP streams, can use the compatibility add-ons QtFtp and QtHttp which provides the QFtp and QHttp classes as they existed in Qt 4.

, , classes are not public anymore. Use QNetworkAccessManager instead to avoid binary breaks in the future. Programs that require raw FTP/HTTP streams, can use the compatibility add-ons QtFtp and QtHttp which provides the and classes as they existed in Qt 4. The QAbstractSocket::connectToHost() and QAbstractSocket::disconnectFromHost() functions are virtual now, and QAbstractSocket::connectToHostImplementation() and

QAbstractSocket::disconnectFromHostImplementation() are removed.

and are removed. The QTcpServer::incomingConnection() function now takes an argument of type qintptr instead of an int .

instead of an . QNetworkConfiguration::bearerName() is removed. Use the bearerTypeName() instead.

Changes to Qt SQL

QSqlQueryModel::indexInQuery is virtual now.

QSqlQueryMode::setQuery emits fewer signals. The modelAboutToBeReset() and modelReset() signals are sufficient to inform views that they must re-interrogate the model.

and signals are sufficient to inform views that they must re-interrogate the model. The QSqlDriver::subscribeToNotification, QSqlDriver::unsubscribeFromNotification, QSqlDriver::subscribedToNotifications, QSqlDriver::isIdentifierEscaped, and QSqlDriver::stripDelimiters functions are virtual now. The corresponding xxxImplementation functions are also removed as the subclasses of QSqlDriver can re-implement those directly.

Changes to Qt Test

The following source incompatible changes are made in this module:

The plain-text, XML and lightxml test output formats are updated to include test result for every row of test data in data-driven tests. In Qt4, only fails and skips were included for individual data rows without the passes information. This limitation prevented accurate test run and pass rates calculation.

The QTRY_VERIFY and QTRY_COMPARE macros are now part of QTestLib . These macros were part of tests/shared/util.h earlier, but now they are part of the <QtTest/QtTest> header. In addition, QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT are provided to specify custom timeout values.

and macros are now part of . These macros were part of earlier, but now they are part of the <QtTest/QtTest> header. In addition, and are provided to specify custom timeout values. The QTEST_NOOP_MAIN macro is removed. If a test appears to be inapplicable for a particular build at compile-time, it should be omitted either using the .pro file logic or call QSKIP in the initTestCase() method to skip the entire test. If you’re using the later approach, report a meaningful explanation in the test log.

macro is removed. If a test appears to be inapplicable for a particular build at compile-time, it should be omitted either using the .pro file logic or call in the method to skip the entire test. If you’re using the later approach, report a meaningful explanation in the test log. The DEPENDS_ON macro is removed as it misled some users to believe that they could make test functions depend on each other or impose an execution order on test functions.

macro is removed as it misled some users to believe that they could make test functions depend on each other or impose an execution order on test functions. The QTest::qt_snprintf() function is removed. This was an internal test library function that was exposed in the public API due to its use in a public macro. Any calls to this function must be replaced with QByteArray::qsnprintf() .

. The QTest::pixmapsAreEqual() function is removed. Comparison of QPixmap objects must be done using the QCOMPARE macro, which provides more informative output in the event of a failure.

function is removed. Comparison of QPixmap objects must be done using the macro, which provides more informative output in the event of a failure. The "mode" parameter in QSKIP macro is removed. This parameter caused problems in test metrics calculation because of the SkipAll mode, which hid information about the skipped test data. Calling QSKIP in a test function now behaves like SkipSingle , which is skipping a non-data-driven test function or skipping only the current data row of a data-driven test function. Every skipped data row is now reported in the test log.

parameter in macro is removed. This parameter caused problems in test metrics calculation because of the mode, which hid information about the skipped test data. Calling in a test function now behaves like , which is skipping a non-data-driven test function or skipping only the current data row of a data-driven test function. Every skipped data row is now reported in the test log. QTest::qWaitForWindowShown() is replaced with QTest::qWaitForWindowExposed().

Changes to Qt Global

The following source incompatible changes are made:

qMacVersion() : This global function is removed. Use QSysInfo::macVersion() or QSysInfo::MacintoshVersion instead.

: This global function is removed. Use QSysInfo::macVersion() or QSysInfo::MacintoshVersion instead. escape(): This global function is deprecated. Use QString::toHtmlEscaped() instead.

qIsDetached<> : This global function is removed as it is not relevant anymore for multi-threaded applications. There is no replacement for this function.

Changes to tools

Avoid using qttest_p4.prf file. We recommend that you explicitly enable the preferences you want. Autotest .pro files must stop using 'load(qttest_p4)' and use 'CONFIG+=testcase' instead.

file. We recommend that you explicitly enable the preferences you want. Autotest files must stop using and use instead. The -dwarf2 configure argument is removed. DWARF2 is always used on Mac OS X now.

That said, you will need some more extra stuff!

Thirdly and rather importantly, if you have an app written in C++ and you want to port it to Qt5; you have to note three things:

Edit main.cpp and change the #include <QtGui> to #include <QtWidgets> .

– You can find a perl script called fixqt4headers in the bin directory of your Qt package that will automate many of the required header file changes. Edit the animatedtiles.pro and add QT += widgets towards the end of the file.

–QtGui is included by default in all Qt applications unless excluded using the QT -= gui directive in the qmake project file. Run qmake and make utilities to build the binary.

And similar changes are needed if you’re porting from Qt4 to Qt5.

What it, you have developed a QML app and now you’re willing to port it to Qt5?

Here is an example of Flickr Qt4 QML application being ported to Qt5 (From qt-project.org):

Edit all the .qml files and replace import QtQuick 1.0 statements with import QtQuick 2.0 . Add the additional import QtQuick.XmlListModel 2.0 statement to qml/common/RssModel.qml .Note: XmlListModel is part of a submodule under QtQuick and it must be imported explicitly to use it. Make the following changes to qmlapplicationviewer/qmlapplicationviewer.h : Replace the #include <QtDeclarative/QDeclarativeView> with #include <QQuickView> .

with . Replace QDeclarativeView with QQuickView in the class declaration for QmlApplicationViewer .

with in the class declaration for . Replace the parameter for QmlApplicationViewer constructor from QWidget to QWindow . Make the following changes to qmlapplicationviewer/qmlapplicationviewer.cpp :

Replace all the QtCore and QtDeclarative include statements with these:

#include <QCoreApplication> #include <QDir> #include <QFileInfo> #include <QQmlComponent> #include <QQmlEngine> #include <QQmlContext> #include <QDebug>

Replace all instances of QWidget with QWindow , and QDeclarativeView with QQuickView .

with , and with . Remove the code between #if defined(Q_OS_SYMBIAN) and #endif macros as Symbian platform is not supported in Qt 5.

and macros as Symbian platform is not supported in Qt 5. Remove the code between #if QT_VERSION < 0x040702 and #else , and #endif // QT_VERSION < 0x040702 macros towards the end.

5. Run the qmake and make utilities to build the application.

Note: Ensure that the PATH environment variable is pointing to the Qt 5 binaries and libraries directories, before running qmake .

Run the flickr application to see whether it behaves as expected. Here is a snapshot of the application running on Ubuntu v12.04:

So these are the basic needs for a developers if they want to port their application to Sailfish, Yes! only the basic info!

There are more information for transitions from Qt4 to Qt5 in here

SDL 1.2 to SDL 2.0 migration here

And for the Debian RPM packaging Here

Sadly WordPress did not allow me to add those informations as well because the post would get mighty long!

But anyhow, a quick reminder: This post is entirely gathered from qt-project.org and I created this just for the sake of making things easier and put all of the in a place.

I hope it was helpful to all you developers out there; Please show your interest in the comment section.

Sepehr Noori (James)