C++ API changes Qt 5

download C++ API changes  Qt 5

of 20

Transcript of C++ API changes Qt 5

  • 8/17/2019 C++ API changes Qt 5

    1/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html

    Contents

    Changes to Qt Core

    Changes to QAction

    Changes to QChar

    Changes to QCoreApplication

    Changes to QEvent

    Changes to QFile

    Changes to QFont

    Changes to QMetaType

    Changes to QMetaMethod

    Changes to QObject

    Changes to QVariant

    Changes to QAbstractEventDispatcher

    Changes to QDir

    Changes to QLocale

    Changes to QAbstractItemModel

    Changes to QString

    Changes to QDate, QTime, and QDateTime

    Changes to QTextCodec

    Changes to QUrl

    Changes to Qt ConcurrentChanges to Qt GUI

    Changes to QAccessibleInterface

    Changes to QImage

    Changes to QPainter

    Changes to QTouchEvent

    Changes to Qt Widgets

    Changes to QApplication

    Changes to QStyle

     

    Qt Documentation

     

    Wiki Documentation Forum Bug Reports Code Review

    Qt 5.5 › C++ API changes

    Menu

    http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://doc.qt.io/qt-5/index.htmlhttp://doc.qt.io/http://forum.qt.io/https://bugreports.qt.io/http://qt.io/http://qt.io/http://-/?-http://-/?-http://-/?-http://qt.io/https://account.qt.io/loginhttp://blog.qt.io/http://qt.io/partners/http://doc.qt.io/qt-5/index.htmlhttps://codereview.qt-project.org/https://bugreports.qt.io/http://forum.qt.io/http://doc.qt.io/http://wiki.qt.io/http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-

  • 8/17/2019 C++ API changes Qt 5

    2/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 2

    Changes to QHeaderView

    Changes to QAbstractItemView

    Changes to QColorDialog

    Changes to Qt WebKit

    Changes to Qt Print Support

    Changes to Qt Network

    Changes to QSslCertificate

    Changes to Qt SQL

    Changes to Qt Test

    Changes to Qt OpenGL

    Changes to Qt Global

    Changes to Tools

    Related Topics

    Reference

    All Qt C++ Classes

    All QML Types

    All Qt Modules

    Qt Creator Manual

    All Qt Reference Documentation

    Getting Started

    Getting Started with Qt

    What's New in Qt 5

    Examples and Tutorials

    Supported Platforms

    Qt Licensing

    Overviews

    Development Tools

    User Interfaces

    Core Internals

    Data Storage

    http://doc.qt.io/qt-5/qt5-intro.html#multimediahttp://doc.qt.io/qt-5/topics-data-storage.htmlhttp://doc.qt.io/qt-5/topics-core.htmlhttp://doc.qt.io/qt-5/topics-ui.htmlhttp://doc.qt.io/qt-5/topics-app-development.htmlhttp://doc.qt.io/qt-5/licensing.htmlhttp://doc.qt.io/qt-5/supported-platforms.htmlhttp://doc.qt.io/qt-5/qtexamplesandtutorials.htmlhttp://doc.qt.io/qt-5/qt5-intro.htmlhttp://doc.qt.io/qt-5/gettingstarted.htmlhttp://doc.qt.io/qt-5/reference-overview.htmlhttp://doc.qt.io/qtcreator/index.htmlhttp://doc.qt.io/qt-5/qtmodules.htmlhttp://doc.qt.io/qt-5/qmltypes.htmlhttp://doc.qt.io/qt-5/classes.htmlhttp://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-

  • 8/17/2019 C++ API changes Qt 5

    3/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 3

    Multimedia

    Networking and Connectivity

    Graphics

    Mobile APIs

    QML Applications

    All Qt Overviews

    C++ API changes

    Qt 5 introduces some source incompatible changes. Here we list some important ones, but

    you can find more complete lists in /qtbase/dist/changes-5.x.x.

    The following sections list the API changes in each module and provide recommendations for

    handling those changes.

    Changes to Qt Core

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

    QLibraryInfo::buildKey()  and the corresponding QT_BUILD_KEY macro areremoved. You must remove all references to this function and macro, as build key is notnecessary now.

    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 yoursources.

    QBool is removed. In Qt 4, QString::contains(), QByteArray::contains(), andQList::contains() returned an internal QBool type so that the Qt3 code if(a.contains() == 2) would not compile anymore. If your code uses QBool, replace itwith bool.

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

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

    QSystemLocale is not public anymore. Use QLocale instead.

    Default value of the QSortFilterProxyModel::dynamicSortFilter property is changed to

    http://doc.qt.io/qt-5/qsortfilterproxymodel.html#dynamicSortFilter-prophttp://doc.qt.io/qt-5/qlocale.htmlhttp://doc.qt.io/qt-5/qprocess.html#ProcessChannelMode-enumhttp://doc.qt.io/qt-5/quuid.html#toStringhttp://doc.qt.io/qt-5/qlist.html#containshttp://doc.qt.io/qt-5/qbytearray.html#containshttp://doc.qt.io/qt-5/qstring.html#containshttp://doc.qt.io/qt-5/qtranslator.html#translatehttp://doc.qt.io/qt-5/qlibrary.html#resolvehttp://doc.qt.io/qt-5/overviews-main.htmlhttp://doc.qt.io/qt-5/qmlapplications.htmlhttp://doc.qt.io/qt-5/mobiledevelopment.htmlhttp://doc.qt.io/qt-5/topics-graphics.htmlhttp://doc.qt.io/qt-5/topics-network-connectivity.htmlhttp://doc.qt.io/qt-5/qt5-intro.html#multimedia

  • 8/17/2019 C++ API changes Qt 5

    4/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 4

     true.

    QTextCodecPlugin is removed as all the text codecs are part of Qt Core now.

    QFSFileEngine, QAbstractFileEngine , QAbstractFileEngineIterator , andQAbstractFileEngineHandler  are no longer public. We recommend you to avoidusing these classes as there is no compatibility promise.

    qDebug(), qWarning(), qCritical(), and qFatal() are changed to macros now to track theorigin 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  environmentvariable. qInstallMsgHandler() is deprecated, so we recommend usingqInstallMessageHandler() 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 versions, if aQPointer is used on a QWidget (or a subclass of QWidget), the QPointer was cleared bythe QWidget destructor. In Qt 5, the QPointer is cleared by the QObject destructor alongwith the QWeakPointers. Any QPointer tracking a widget is not cleared before theQWidget destructor destroys the children for the widget being tracked.

    Qt::WFlags is deprecated, use Qt::WindowFlags instead. This typedef dates from the Qt 1

    days, and such abbreviations are not current Qt style.

    Qt::HANDLE typedef is now defined as void * on all platforms.

    The non-atomic convenience methods of QAtomicInt and QAtomicPointer (that is,operator=, operator int, operator T*, operator!, operator==, operator!=, andoperator->) have been removed as they performed implicit loads and stores of unspecified memory ordering. Code dealing with loading and storing is expected to useload(), loadAquire(), store(), and storeRelease(), instead.

    The return type of QFlags::operator int() matches the enum's underlyingtype (signed or unsigned) instead of always being int. This allows QFlags over enums of the unsigned type (for example, Qt::MouseButton).

    Because of major changes in the behavior of QTextBoundaryFinder::boundaryReasons(),the StartWord and EndWord enum values were replaced with the StartOfItem andEndOfItem values to enforce revision of the affected code.

    A number of functions in are deprecated. Use the implementationsavailable in the STL, as described in Porting Guidelines.

    setSharable() and isSharable() in Qt containers are deprecated and will beremoved in Qt 6. You should not use them in new applications. If you used them inexisting applications, even though they are not documented, you should port away fromthem.

    Changes to QAction

    The Softkeys API is removed, so the following functions and enums are removed:

    QAction::setSoftKeyRole()

    QAction::softKeyRole()

    QAction::SoftKeyRole

    http://doc.qt.io/qt-5/qtalgorithms.html#porting-guidelineshttp://doc.qt.io/qt-5/qtextboundaryfinder.html#boundaryReasonshttp://doc.qt.io/qt-5/qt.html#MouseButton-enumhttp://doc.qt.io/qt-5/qflags.htmlhttp://doc.qt.io/qt-5/qatomicpointer.htmlhttp://doc.qt.io/qt-5/qatomicint.htmlhttp://doc.qt.io/qt-5/qt.html#HANDLE-typedefhttp://doc.qt.io/qt-5/qt.html#WindowType-enumhttp://doc.qt.io/qt-5/qt-obsolete.html#WFlags-typedefhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qweakpointer.htmlhttp://doc.qt.io/qt-5/qobject.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qweakpointer.htmlhttp://doc.qt.io/qt-5/qpointer.htmlhttp://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandlerhttp://doc.qt.io/qt-5/qtglobal-obsolete.html#qInstallMsgHandlerhttp://doc.qt.io/qt-5/qtglobal.html#qFatalhttp://doc.qt.io/qt-5/qtglobal.html#qCriticalhttp://doc.qt.io/qt-5/qtglobal.html#qWarninghttp://doc.qt.io/qt-5/qtglobal.html#qDebughttp://doc.qt.io/qt-5/qsortfilterproxymodel.html#dynamicSortFilter-prop

  • 8/17/2019 C++ API changes Qt 5

    5/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 5

    Qt::WA_MergeSoftkeys

    Qt::WA_MergeSoftkeysRecursively

    Qt::WindowSoftkeysVisibleHint

    Qt::WindowSoftkeysRespondHint

    Changes to QChar

    QChar::NoCategory  is removed. The QChar::Other_NotAssigned enum value is returnedfor unassigned codepoints now.

    QChar::Joining and QChar::joining() are deprecated. Use the QChar::JoiningType enum andQChar::joiningType() function instead.

    Changes to QCoreApplication

    QCoreApplication::translate() no longer returns the source text if the translation is empty.Use the Qt Linguist Release tool (lrelease -removeidentical) instead foroptimization.

    QCoreApplication::setEventFilter()  andQApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilteare replaced with QCoreApplication::installNativeEventFilter() andQCoreApplication::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.

    QCoreApplication::Type  and QApplication::type()  are removed. These Qt 3legacy application types did not match the application types available in Qt 5. Useqobject_cast instead to dynamically find out the exact application type.

    QCoreApplication::hasPendingEvents and QAbstractEventDispatcher::hasPendingEventsare deprecated.

    Changes to QEventQEvent::AccessibilityPrepare , QEvent::AccessibilityHelp , andQEvent::AccessibilityDescription  are removed.

    QEvent::TouchCancel is introduced to use it on systems where it makes sense todifferentiate between a regular QEvent::TouchEnd and abrupt touch sequencecancellations caused by the compositor. For example, when a swype gesture isrecognized.

     

    http://doc.qt.io/qt-5/qevent.html#Type-enumhttp://doc.qt.io/qt-5/qevent.html#Type-enumhttp://doc.qt.io/qt-5/qabstracteventdispatcher-obsolete.html#hasPendingEventshttp://doc.qt.io/qt-5/qcoreapplication-obsolete.html#hasPendingEventshttp://doc.qt.io/qt-5/qpa.htmlhttp://doc.qt.io/qt-5/qevent.htmlhttp://doc.qt.io/qt-5/qcoreapplication.html#removeNativeEventFilterhttp://doc.qt.io/qt-5/qcoreapplication.html#installNativeEventFilterhttp://doc.qt.io/qt-5/qcoreapplication.html#translatehttp://doc.qt.io/qt-5/qchar.html#joiningTypehttp://doc.qt.io/qt-5/qchar.html#JoiningType-enumhttp://doc.qt.io/qt-5/qchar-obsolete.html#joininghttp://doc.qt.io/qt-5/qchar-obsolete.html#Joining-enumhttp://doc.qt.io/qt-5/qchar.html#Category-enum

  • 8/17/2019 C++ API changes Qt 5

    6/20

    10/10/2015   C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 6

     

    QFile::setEncodingFunction() and QFile::setDecodingFunction() are deprecated.

    QFile::encodeName() and QFile::decodeName() are now hard-coded to operate onQString::fromLocal8Bit() and QString::toLocal8Bit() only. The old behavior is still possibleusing QTextCodec::setCodecForLocale(), but the new code should not make assumptionsabout the file system encoding and older code should remove such assumptions.

    Changes to QFont

    QFont::handle() is removed.

    QFont::rawName() and QFont::setRawName() are deprecated.

    Changes to QMetaType

    QMetaType::construct()  is renamed as QMetaType::create().

    QMetaType::unregisterType()  is removed.

    QMetaType now records whether the type argument inherits QObject. Such informationcan be useful for scripting APIs, so that custom QObject subclasses are treated asQObject pointers. For example, in Qt Script this means QScriptValue::isQObject() can betrue, where it was false before.

    QMetaType::QWidgetStar  is removed. Use qMetaTypeId() orQVariant::canConvert() instead.

    Q_DECLARE_METATYPE(type)  now requires type to be fully defined. This means,Q_DECLARE_METATYPE(QSharedPointer)  andQ_DECLARE_METATYPE(QWeakPointer)  also need type to be fully defined. In caseswhere a forward declared type is needed as a meta-type, useQ_DECLARE_OPAQUE_POINTER(type) .

    Changes to QMetaMethod

    QMetaMethod::signature()  is renamed as QMetaMethod::methodSignature(), and the

    return type is changed to QByteArray. This change is to enable generating the signaturestring 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 returnsvoid is to compare the return value of QMetaMethod::returnType() withQMetaType::Void.

    Changes to QObject

     

    http://doc.qt.io/qt-5/qobject.html#disconnectNotifyhttp://doc.qt.io/qt-5/qmetamethod.htmlhttp://doc.qt.io/qt-5/qobject.html#disconnectNotifyhttp://doc.qt.io/qt-5/qobject.html#connectNotifyhttp://doc.qt.io/qt-5/qmetatype.html#Type-enumhttp://doc.qt.io/qt-5/qmetamethod.html#returnTypehttp://doc.qt.io/qt-5/qmetamethod.html#typeNamehttp://doc.qt.io/qt-5/qbytearray.htmlhttp://doc.qt.io/qt-5/qmetamethod.html#methodSignaturehttp://doc.qt.io/qt-5/qvariant.html#canConverthttp://doc.qt.io/qt-5/qmetatype.html#qMetaTypeIdhttp://doc.qt.io/qt-5/qscriptvalue.html#isQObjecthttp://doc.qt.io/qt-5/qtscript-index.htmlhttp://doc.qt.io/qt-5/qobject.htmlhttp://doc.qt.io/qt-5/qobject.htmlhttp://doc.qt.io/qt-5/qobject.htmlhttp://doc.qt.io/qt-5/qmetatype.htmlhttp://doc.qt.io/qt-5/qmetatype.html#createhttp://doc.qt.io/qt-5/qfont-obsolete.html#setRawNamehttp://doc.qt.io/qt-5/qfont-obsolete.html#rawNamehttp://doc.qt.io/qt-5/qtextcodec.html#setCodecForLocalehttp://doc.qt.io/qt-5/qstring.html#toLocal8Bithttp://doc.qt.io/qt-5/qstring.html#fromLocal8Bithttp://doc.qt.io/qt-5/qfile.html#decodeNamehttp://doc.qt.io/qt-5/qfile.html#encodeNamehttp://doc.qt.io/qt-5/qfile-obsolete.html#setDecodingFunctionhttp://doc.qt.io/qt-5/qfile-obsolete.html#setEncodingFunction

  • 8/17/2019 C++ API changes Qt 5

    7/20

    10/10/2015   C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 7

    ec ::connec o y  an ec :: sconnec o y  now nee a e a e oargument that identifies the signal, rather than a const char pointer.

    QObject::trUtf8() and QCoreApplication::Encoding  are deprecated. Qt assumes thatthe source code is encoded in UTF-8.

    Changes to QVariant

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

    Implicit creation of QVariant objects from the enum values Qt::BrushStyle, Qt::PenStyle,and Qt::CursorShape has been removed. Create objects explicitly or usestatic_cast(Qt::SolidLine)  to create a QVariant of type int with the samevalue as the enum.

    Changes to QAbstractEventDispatcher

    The signature for the pure-virtual registerTimer() function is changed. All subclassesof QAbstractEventDispatcher must re-implement the function with this new signature:

    virtual void registerTimer(int timerId, int interval,Qt::TimerType

    QAbstractEventDispatcher::TimerInfo is no longer a typedef of QPair. It isnow a struct with 3 members: int timerId, int interval, and Qt::TimerTypetimerType. Update the QAbstractEventDispatcher::registeredTimers() function with thischange.

    Changes to QDir

    The convertSeparators() function is removed. Use QDir::toNativeSeparators() instead.

    The QDir::NoDotAndDotDot  enum value is removed. Use QDir::NoDot orQDir::NoDotDot instead.

    Changes to QLocale

    The QLocale data has been updated to CLDR 22.1. The historical language and countrynames were updated to their modern values and some deprecated names were droppedor mapped to their modern alternatives.

     

    http://doc.qt.io/qt-5/qlocale.html#toUShorthttp://doc.qt.io/qt-5/qlocale.html#toInthttp://doc.qt.io/qt-5/qlocale.html#toUInthttp://doc.qt.io/qt-5/qlocale.html#toInthttp://doc.qt.io/qt-5/qlocale.html#toUShorthttp://doc.qt.io/qt-5/qlocale.html#toShorthttp://doc.qt.io/qt-5/qlocale.htmlhttp://doc.qt.io/qt-5/qdir.html#Filter-enumhttp://doc.qt.io/qt-5/qdir.html#Filter-enumhttp://doc.qt.io/qt-5/qdir.html#toNativeSeparatorshttp://doc.qt.io/qt-5/qabstracteventdispatcher.html#registeredTimershttp://doc.qt.io/qt-5/qabstracteventdispatcher-timerinfo.htmlhttp://doc.qt.io/qt-5/qt.htmlhttp://doc.qt.io/qt-5/qabstracteventdispatcher.htmlhttp://doc.qt.io/qt-5/qvariant.htmlhttp://doc.qt.io/qt-5/qt.html#CursorShape-enumhttp://doc.qt.io/qt-5/qt.html#PenStyle-enumhttp://doc.qt.io/qt-5/qt.html#BrushStyle-enumhttp://doc.qt.io/qt-5/qvariant.htmlhttp://doc.qt.io/qt-5/qvariant.htmlhttp://doc.qt.io/qt-5/qcolor.htmlhttp://doc.qt.io/qt-5/qt.html#GlobalColor-enumhttp://doc.qt.io/qt-5/qvariant.htmlhttp://doc.qt.io/qt-5/qobject-obsolete.html#trUtf8http://doc.qt.io/qt-5/qmetamethod.htmlhttp://doc.qt.io/qt-5/qobject.html#disconnectNotifyhttp://doc.qt.io/qt-5/qobject.html#connectNotify

  • 8/17/2019 C++ API changes Qt 5

    8/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 8

      , , , ,QLocale::toLongLong(), and QLocale::toULongLong() functions no longer take theargument for base. They localize base 10 conversions. To convert other bases, use theQString functions instead.

    Changes to QAbstractItemModel

    QAbstractItemModel::beginMoveRows() no longer emits the layoutAboutToBeChangedsignal, and QAbstractItemModel::endMoveRows() no longer emits the layoutChangedsignal. All proxy models must connect to (and disconnect from) theQAbstractItemModel::rowsAboutToBeMoved and QAbstractItemModel::rowsMovedsignals.

    QAbstractItemModel::sibling() is virtual now to allow implementations to optimize basedon internal data.

    QAbstractItemModel::createIndex() method now only provides the void* and quintptroverloads, making calls with a literal 0 (createIndex(row, col, 0)) ambiguous. Eithercast quintptr(0) or omit the third argument to get the void* overload.

    QAbstractItemModel::setRoleNames() is deprecated. UseQAbstractItemModel::roleNames() instead. QAbstractItemModel::roleNames() is virtualnow to allow a consistent API with the rest of QAbstractItemModel. Reimplementing thevirtual methods to provide the elements is preferred to setting those directly.

    Changes to QString

    QString and QByteArray constructors now use a negative size to indicate that the stringpassed 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 QString and QByteArray. The sizeargument now has a default value of -1, replacing the separate constructors that did thesame.

    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 or byte). In Qt 4, they returned a null QString or anull QStringRef.

    The following QString functions use the C locale instead of the default or system locale:

    toLongLong()

    toULongLong()

    toLong()

    toULong()

    toInt()

    toUInt()

    toShort()

    toUShort()

    http://doc.qt.io/qt-5/qstring.html#toUShorthttp://doc.qt.io/qt-5/qstring.html#toShorthttp://doc.qt.io/qt-5/qstring.html#toUInthttp://doc.qt.io/qt-5/qstring.html#toInthttp://doc.qt.io/qt-5/qstring.html#toULonghttp://doc.qt.io/qt-5/qstring.html#toLonghttp://doc.qt.io/qt-5/qstring.html#toULongLonghttp://doc.qt.io/qt-5/qstring.html#toLongLonghttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qbytearray.html#midhttp://doc.qt.io/qt-5/qstring.html#midRefhttp://doc.qt.io/qt-5/qstring.html#midhttp://doc.qt.io/qt-5/qbytearray.htmlhttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qchar.htmlhttp://doc.qt.io/qt-5/qbytearray.htmlhttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qabstractitemmodel.htmlhttp://doc.qt.io/qt-5/qabstractitemmodel.html#roleNameshttp://doc.qt.io/qt-5/qabstractitemmodel.html#roleNameshttp://doc.qt.io/qt-5/qabstractitemmodel-obsolete.html#setRoleNameshttp://doc.qt.io/qt-5/qabstractitemmodel.html#createIndexhttp://doc.qt.io/qt-5/qabstractitemmodel.html#siblinghttp://doc.qt.io/qt-5/qabstractitemmodel.html#rowsMovedhttp://doc.qt.io/qt-5/qabstractitemmodel.html#rowsAboutToBeMovedhttp://doc.qt.io/qt-5/qabstractitemmodel.html#endMoveRowshttp://doc.qt.io/qt-5/qabstractitemmodel.html#beginMoveRowshttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qlocale.html#toULongLonghttp://doc.qt.io/qt-5/qlocale.html#toLongLonghttp://doc.qt.io/qt-5/qlocale.html#toUInthttp://doc.qt.io/qt-5/qlocale.html#toInthttp://doc.qt.io/qt-5/qlocale.html#toUShorthttp://doc.qt.io/qt-5/qlocale.html#toShort

  • 8/17/2019 C++ API changes Qt 5

    9/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 9

    toDouble()

    toFloat()

    This is to guarantee consistent default conversion of strings. For locale-aware conversions

    use the equivalent QLocale functions.

    Changes to QDate, QTime, and QDateTime

    QDate only implements the Gregorian calendar, and the switch to the Julian calendarbefore 1582 has been removed. This means all QDate functions return different resultsfor dates prior to 15 October 1582, and there is no longer a gap between 4 October 1582and 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 validQDate/QTime.

    The QDate::addDays() and QDateTime::addDays() functions now take a qint64 argument,and the QDate::daysTo() and QDateTime::daysTo() functions now return a qint64 value.

    QDate and QTime are the userProperty for the QTimeEdit and QDateEdit classes,insted of QDateTime as it was for the 4.7 and 4.8 releases. The USER property for theseclasses was removed before Qt 4.7.0 and added again in Qt 5.0.

    The serialization behavior for QDateTime is reverted to pre-Qt 5, because Qt::LocalTime isthe local time (that is, ymd hms) regardless of the underlying system time, time zone, orchanges in the system zone. Therefore, the consistent behavior when serialising is to saveand restore as the local time and not its UTC equivalent. This means that the

    QDataStream version is 14 since Qt 5.1.The supported date range in QDateTime has been reduced to about +/- 292 million years,the range supported by the number of msecs since the Unix epoch of 1 Jan 1970 asstored in a qint64, and as able to be used in QDateTime::setMSecsSinceEpoch() andQDateTime::toMSecsSinceEpoch().

    QDate::fromString() and QDateTime::fromString() require non-numeric date componentseparators when parsing Qt::ISODate. A string like 2000901901 will no longer berecognized as a valid ISO date, whereas 2000/01/01 will, even though it differs from theISO format 2000-01-01.

    Changes to QTextCodec

    QTextCodec::codecForCStrings()  and QTextCodec::setCodecForCStrings()are removed as they were creating uncertainty/bugs in using QString easily and (to alesser extent) performance issues.

    QTextCodec::codecForTr()  and QTextCodec::setCodecForTr() are removed.

     

    http://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qt.html#DateFormat-enumhttp://doc.qt.io/qt-5/qdatetime.html#fromStringhttp://doc.qt.io/qt-5/qdate.html#fromStringhttp://doc.qt.io/qt-5/qdatetime.html#toMSecsSinceEpochhttp://doc.qt.io/qt-5/qdatetime.html#setMSecsSinceEpochhttp://doc.qt.io/qt-5/qdatetime.htmlhttp://doc.qt.io/qt-5/qdatastream.htmlhttp://doc.qt.io/qt-5/qt.html#TimeSpec-enumhttp://doc.qt.io/qt-5/qdatetime.htmlhttp://doc.qt.io/qt-5/qdatetime.htmlhttp://doc.qt.io/qt-5/qdateedit.htmlhttp://doc.qt.io/qt-5/qtimeedit.htmlhttp://doc.qt.io/qt-5/qtime.htmlhttp://doc.qt.io/qt-5/qdate.htmlhttp://doc.qt.io/qt-5/qdatetime.html#daysTohttp://doc.qt.io/qt-5/qdate.html#daysTohttp://doc.qt.io/qt-5/qdatetime.html#addDayshttp://doc.qt.io/qt-5/qdate.html#addDayshttp://doc.qt.io/qt-5/qtime.htmlhttp://doc.qt.io/qt-5/qdate.htmlhttp://doc.qt.io/qt-5/qtime.htmlhttp://doc.qt.io/qt-5/qdate.htmlhttp://doc.qt.io/qt-5/qdate.html#setDatehttp://doc.qt.io/qt-5/qdate-obsolete.html#setYMDhttp://doc.qt.io/qt-5/qdate.htmlhttp://doc.qt.io/qt-5/qdate.htmlhttp://doc.qt.io/qt-5/qlocale.htmlhttp://doc.qt.io/qt-5/qstring.html#toFloathttp://doc.qt.io/qt-5/qstring.html#toDouble

  • 8/17/2019 C++ API changes Qt 5

    10/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 10

     

    QUrl changed considerably in Qt 5 to comply better with the URL specifications and with

    brokenness out there. The following list summarizes the most important functional changes:

    QUrl::setPath() no longer handles relative paths. They are by definition invalid. Use theQUrl::NormalizePathSegments flag to remove /./ or /../ sequences as much as possible. Itwill not remove /../ from the beginning of the path.

    QUrl has been changed to operate only on percent-encoded forms. Fully-decoded formswhere the percent character stands for itself, can no longer be encoded, as the gettersand setters with encoded  in the name are deprecated (except QUrl::toEncoded() andQUrl::fromEncoded()).

    The most notable difference with this change is when dealing with QUrl::toString(). In

    earlier Qt versions, this function would return percent characters in the URL, but now it

    returns %25  like QUrl::toEncoded() does.

    QUrl no longer decodes %7B and %7D to "{" and "}" in the output of QUrl::toString().

    QUrl now defaults to decoded mode in the getters and setters for userName, password,

    host, topLevelDomain, path and fileName. This means a % in one of those fields isnow returned (or set) as % rather than %25. If the former behavior was expected, passPrettyDecoded to the getter and TolerantMode to the setter.

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

    QUrl no longer considers all delimiter characters equivalent to their percent-encodedforms. QUrl and QUrlQuery always keep all delimiters exactly as they were in the originalURL text.

    QUrl no longer supports QUrl::FullyDecoded mode in QUrl::authority() andQUrl::userInfo(), nor QUrl::DecodedMode in QUrl::setAuthority() and QUrl::setUserInfo().

    QUrl no longer decodes %23 found in the fragment to "#" in the output of QUrl::toString(FullyEncoded) or QUrl::toEncoded().

    Changes to Qt Concurrent

    Qt Concurrent has been moved from Qt Core to its own module. To link against the Qt Coremodule, add this line to the project file:

    QT += concurrent

    Note: The QtConcurrent::Exception  class is renamed QException and

    QtConcurrent::UnhandledException  class is renamed QUnhandledException. They

    remain in t Core.

    http://doc.qt.io/qt-5/qunhandledexception.htmlhttp://doc.qt.io/qt-5/qexception.htmlhttp://doc.qt.io/qt-5/qtcore-index.htmlhttp://doc.qt.io/qt-5/qtconcurrent-index.htmlhttp://doc.qt.io/qt-5/qurl.html#toEncodedhttp://doc.qt.io/qt-5/qurl.html#toStringhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.html#setUserInfohttp://doc.qt.io/qt-5/qurl.html#setAuthorityhttp://doc.qt.io/qt-5/qurl.html#ParsingMode-enumhttp://doc.qt.io/qt-5/qurl.html#userInfohttp://doc.qt.io/qt-5/qurl.html#authorityhttp://doc.qt.io/qt-5/qurl.html#ComponentFormattingOption-enumhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurlquery.htmlhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurlquery.htmlhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.html#toStringhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.html#toEncodedhttp://doc.qt.io/qt-5/qurl.html#toStringhttp://doc.qt.io/qt-5/qurl.html#fromEncodedhttp://doc.qt.io/qt-5/qurl.html#toEncodedhttp://doc.qt.io/qt-5/qurl.htmlhttp://doc.qt.io/qt-5/qurl.html#UrlFormattingOption-enumhttp://doc.qt.io/qt-5/qurl.html#setPathhttp://doc.qt.io/qt-5/qurl.html

  • 8/17/2019 C++ API changes Qt 5

    11/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 1

     

    Changes to Qt GUI

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

    QAccessibleActionInterface is now based on providing a list of action names. All functionshave been changed to take arguments of type string insted of int.

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

    The constructor of QTabletEvent does not need the hiResGlobalPos argumentanymore, as all coordinates are floating point-based now.

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

    QSound is moved to Qt Multimedia from Qt GUI.

    QDesktopServices::storageLocation()  andQDesktopServices::displayName()  are replaced byQStandardPaths::writableLocation() and QStandardPaths::displayName() respectively.They are now in the Qt Core module. Make sure to read theQDesktopServices::storageLocation() documentation when porting fromQDesktopServices::DataLocation.

    QPixmap::grabWindow()  and QPixmap::grabWidget()  are removed. UseQScreen::grabWindow() instead.

    The session management API has been simplified. The commitData() function is

    removed and replaced by the signal QGuiApplication::commitDataRequest(). QApplicationand QGuiApplication will emit this signal from 5.2 onward on supported platforms (Linuxand Windows).

    QWidget *widget() is replaced with QObject *target() to avoid QWidgetdependencies.

    Changes to QAccessibleInterface

    The child  integer parameters are removed to bring QAccessibleInterface closer to

    IAccessible2. This means that 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()

     

    http://doc.qt.io/qt-5/qaccessibleinterface.html#childhttp://doc.qt.io/qt-5/qaccessibleinterface.html#childhttp://doc.qt.io/qt-5/qaccessibleinterface.html#parenthttp://doc.qt.io/qt-5/qaccessibleinterface.html#statehttp://doc.qt.io/qt-5/qaccessibleinterface.html#rolehttp://doc.qt.io/qt-5/qaccessibleinterface.html#setTexthttp://doc.qt.io/qt-5/qaccessibleinterface.html#recthttp://doc.qt.io/qt-5/qaccessibleinterface.html#texthttp://doc.qt.io/qt-5/qaccessibleinterface.htmlhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qguiapplication.htmlhttp://doc.qt.io/qt-5/qapplication.htmlhttp://doc.qt.io/qt-5/qguiapplication.html#commitDataRequesthttp://doc.qt.io/qt-5/qscreen.html#grabWindowhttp://doc.qt.io/qt-5/qdesktopservices-obsolete.html#StandardLocation-enumhttp://doc.qt.io/qt-5/qdesktopservices-obsolete.html#storageLocationhttp://doc.qt.io/qt-5/qtcore-index.htmlhttp://doc.qt.io/qt-5/qstandardpaths.html#displayNamehttp://doc.qt.io/qt-5/qstandardpaths.html#writableLocationhttp://doc.qt.io/qt-5/qsound.htmlhttp://doc.qt.io/qt-5/qiconengine.htmlhttp://doc.qt.io/qt-5/qtabletevent.htmlhttp://doc.qt.io/qt-5/qaccessibleevent.htmlhttp://doc.qt.io/qt-5/qaccessibleactioninterface.htmlhttp://doc.qt.io/qt-5/qpen.html#isCosmetichttp://doc.qt.io/qt-5/qpen.html

  • 8/17/2019 C++ API changes Qt 5

    12/20

    10/10/2015   C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 12

    nav ga e   s rep ace w t parent  an c  to nav gate t e erarc y.

    relationTo() is replaced with relations().

    QAccessibleInterface::userActionCount() ,QAccessibleInterface::actionText() , andQAccessibleInterface::doAction()  are removed. We recommend using theQAccessibleInterface subclasses to implement the QAccessibleActionInterface instead.

    Changes to QImage

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

    The behavior of QImage::load(), QImage::loadFromData(), QPixmap::load(), andQPixmap::loadFromData() on a non-null image changed so that if the functions fail to loadthe image (return false), the the existent image data is invalidated, so that isNull() isguaranteed to return true in this case.

    Changes to QPainter

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

    QPainter fill rules when not using antialiased painting have changed so that the aliasedand antialiased coordinate systems match. There used to be an offset of slightly less thanhalf a pixel when doing sub-pixel rendering, in order to be consistent with the old X11paint engine. The new behavior should be more predictable and give the same consistent

    rounding for images and pixmaps as for paths and rectangle filling. To get the oldbehavior, set the QPainter::Qt4CompatiblePainting render hint.

    Changes to QTouchEvent

    QTouchEvent::DeviceType and QTouchEvent::deviceType() are deprecated asQTouchDevice provides a better way to identify and access the device from which theevents originate.

    The constructor now takes a QTouchDevice pointer instead of DeviceType value.TouchPointStateMask  and TouchPointPrimary  are removed from theQt::TouchPointStates enum.

    QTouchEvent::TouchPoint::isPrimary()  is removed.

    Changes to Qt Widgets

     

    http://doc.qt.io/qt-5/qitemeditorfactory.html#valuePropertyNamehttp://doc.qt.io/qt-5/qitemeditorfactory.html#valuePropertyNamehttp://doc.qt.io/qt-5/qitemeditorfactory.html#createEditorhttp://doc.qt.io/qt-5/qt.html#TouchPointState-enumhttp://doc.qt.io/qt-5/qtouchdevice.htmlhttp://doc.qt.io/qt-5/qtouchdevice.htmlhttp://doc.qt.io/qt-5/qtouchevent-obsolete.html#deviceTypehttp://doc.qt.io/qt-5/qtouchevent-obsolete.html#DeviceType-enumhttp://doc.qt.io/qt-5/qpainter.html#RenderHint-enumhttp://doc.qt.io/qt-5/qpainter.htmlhttp://doc.qt.io/qt-5/qpainter.htmlhttp://doc.qt.io/qt-5/qregion.html#unitedhttp://doc.qt.io/qt-5/qpainter.htmlhttp://doc.qt.io/qt-5/qpixmap.html#loadFromDatahttp://doc.qt.io/qt-5/qpixmap.html#loadhttp://doc.qt.io/qt-5/qimage.html#loadFromDatahttp://doc.qt.io/qt-5/qimage.html#loadhttp://doc.qt.io/qt-5/qimage.html#fillhttp://doc.qt.io/qt-5/qaccessibleactioninterface.htmlhttp://doc.qt.io/qt-5/qaccessibleinterface.htmlhttp://doc.qt.io/qt-5/qaccessibleinterface.html#relationshttp://doc.qt.io/qt-5/qaccessibleinterface.html#childhttp://doc.qt.io/qt-5/qaccessibleinterface.html#parent

  • 8/17/2019 C++ API changes Qt 5

    13/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 13

    tem tor actory::create tor  an tem tor actory::va ue roperty amesignatures are changed to take arguments of type int instead of QVariant::Type.

    QInputContext is removed as related getter and setter functions in QWidget andQApplication are removed. Input contexts are now platform-specific.

    QInputDialog::getInteger() is deprecated. Use QInputDialog::getInt() instead.

    The QStyleOption*V{2,3,4} classes are removed, and their members are merged withthe respective base classes. The removed classes are left as typedefs for binary

    compatibility.

    QGraphicsItem and its derived classes can no longer pass a QGraphicsScene to the item'sconstructor. Construct the item without a scene and call QGraphicsScene::addItem() toadd the item to the scene.

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

    Changes to QApplication

    QApplication::setGraphicsSystem()  is removed, because the introduction of QPAmade it redundant.

    QApplication::commitData  and QApplication::saveState virtual methods thatwere used for session management are removed. Connect to theQApplication::commitDataRequest and QApplication::saveStateRequest signals instead.Use QApplication::isSavingSession() if the QWidget::closeEvent if your window needs toknow whether it is being called during shutdown.

    Changes to QStyleQStyle::standardIconImplementation()  andQStyle::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.

    QMotifStyle, QPlastiqueStyle, QCleanlooksStyle , and QCDEStyle are replacedwith a new fusion  style. If your application depends on any of these removed styles, youcan either use the qtstyleplugins project to get these styles or update your application touse the new fusion style. For more details about this change, see

    https://blog.qt.io/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/.The following QStyle implementations have been made internal:

    QFusionStyle

    QGtkStyle

    QMacStyle

    QWindowsCEStyle

    QWindowsMobileStyle

    http://doc.qt.io/qt-5/qstyle.htmlhttps://blog.qt.io/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/http://qt.gitorious.org/qt/qtstylepluginshttp://doc.qt.io/qt-5/qstyle.html#layoutSpacinghttp://doc.qt.io/qt-5/qstyle.html#standardIconhttp://doc.qt.io/qt-5/qwidget.html#closeEventhttp://doc.qt.io/qt-5/qguiapplication.html#isSavingSessionhttp://doc.qt.io/qt-5/qguiapplication.html#saveStateRequesthttp://doc.qt.io/qt-5/qguiapplication.html#commitDataRequesthttp://doc.qt.io/qt-5/qpa.htmlhttp://wiki.qt.io/Qt_5_UI_Helpershttp://doc.qt.io/qt-5/qabstractproxymodel.htmlhttp://doc.qt.io/qt-5/qgraphicsscene.html#addItemhttp://doc.qt.io/qt-5/qgraphicsscene.htmlhttp://doc.qt.io/qt-5/qgraphicsitem.htmlhttp://doc.qt.io/qt-5/qinputdialog.html#getInthttp://doc.qt.io/qt-5/qinputdialog-obsolete.html#getIntegerhttp://doc.qt.io/qt-5/qapplication.htmlhttp://doc.qt.io/qt-5/qwidget.htmlhttp://doc.qt.io/qt-5/qvariant-obsolete.html#Type-enumhttp://doc.qt.io/qt-5/qitemeditorfactory.html#valuePropertyNamehttp://doc.qt.io/qt-5/qitemeditorfactory.html#createEditor

  • 8/17/2019 C++ API changes Qt 5

    14/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 14

    QWindowsVistaStyle

    QWindowsXPStyle

    Instead of creating instances or inheriting these classes directly, use:

    QStyleFactory for creating instances of specific styles.

    QProxyStyle for customizing existing style implementations.

    QCommonStyle as a base for implementing full custom styles.

    Changes to QHeaderView

    The following functions 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) - UseQHeaderView::setSectionResizeMode() instead.

    ResizeMode resizeMode(int logicalindex) const - UseQHeaderView::sectionResizeMode() instead.

    Changes to QAbstractItemView

    The derived classes now emit the clicked() signal on the left mouse click only, insteadof all mouse clicks.

    The virtual QAbstractItemView::dataChanged() function signature now includes the rolesthat have changed. The signature is consistent with the dataChanged() signal in themodel.

    Changes to QColorDialog

    QColorDialog::customColor() now returns a QColor value instead of QRgb.

    QColorDialog::setCustomColor() and QColorDialog::setStandardColor() now need a QColorvalue as their second parameter instead of QRgb.

     

    http://doc.qt.io/qt-5/qcolor.htmlhttp://doc.qt.io/qt-5/qcolordialog.html#setStandardColorhttp://doc.qt.io/qt-5/qcolordialog.html#setCustomColorhttp://doc.qt.io/qt-5/qcolor.htmlhttp://doc.qt.io/qt-5/qcolordialog.html#customColorhttp://doc.qt.io/qt-5/qabstractitemview.html#dataChangedhttp://doc.qt.io/qt-5/qheaderview.html#sectionResizeModehttp://doc.qt.io/qt-5/qheaderview.html#setSectionResizeModehttp://doc.qt.io/qt-5/qheaderview.html#sectionsClickablehttp://doc.qt.io/qt-5/qheaderview.html#setSectionsClickablehttp://doc.qt.io/qt-5/qheaderview.html#sectionsMovablehttp://doc.qt.io/qt-5/qheaderview.html#setSectionsMovablehttp://doc.qt.io/qt-5/qcommonstyle.htmlhttp://doc.qt.io/qt-5/qproxystyle.htmlhttp://doc.qt.io/qt-5/qstylefactory.html

  • 8/17/2019 C++ API changes Qt 5

    15/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 15

     

    The WebKit module in Qt is now split in two modules, webkit and webkitwidgets, inorder to allow the dependency of the widgets module to be optional. The benefits willonly be available once the QQuickWebView API is made public through C++ in a futureversion. The webkitwidgets module adds the webkit module automatically to theproject, so in your application's project file, QT += webkit should now be modified to:

      QT += webkitwidgets

    The same applies to the module include, #include  should bemodified to:

      #include

    A consequence of the module split is that classes of the Qt WebKit API aren't all in thenew module, so for a better compatibility of your application with both Qt4 and Qt5,#include , for example, should be included directly as:

      #include

    The include path will take care of selecting the right module.

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

      #include

      #include

    Changes to Qt Print Support

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

    Support for printing PostScript files has been removed.

    The QAbstractPageSetupDialog  class is removed. Use QPrintDialog instead.

    http://doc.qt.io/qt-5/qprintdialog.htmlhttp://doc.qt.io/qt-5/qwebpage.htmlhttp://doc.qt.io/qt-5/qtwebkit-qmlmodule.htmlhttp://doc.qt.io/qt-5/qtwebkit-index.html

  • 8/17/2019 C++ API changes Qt 5

    16/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 16

     

    The QPrintEngine::PrintEnginePropertyKey enum valuePPK_SuppressSystemPrintStatus  is removed.

    QPrinter no longer allows you to set an invalid printer name.

    Changes to Qt NetworkThe QSsl::TlsV1 enum value is renamed as QSsl::TlsV1_0.

    The QHttp, QHttpHeader, QHttpResponseHeader, and QHttpRequestHeader  classesare removed. Use QNetworkAccessManager instead.

    The QFtp and QUrlInfo classes are no longer exported. Use QNetworkAccessManagerinstead. Programs that require raw FTP or HTTP streams can use the Qt FTP and Qt HTTPcompatibility add-on modules that provide the QFtp and QHttp classes as they existed inQt 4.

    QAbstractSocket::connectToHost() and QAbstractSocket::disconnectFromHost() are virtualnow, and QAbstractSocket::connectToHostImplementation()  andQAbstractSocket::disconnectFromHostImplementation()  are removed.

    QTcpServer::incomingConnection() now takes arguments of type qintptr instead of anint.

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

    Changes to QSslCertificateQSslCertificate::subjectInfo() and QSslCertificate::issuerInfo() now return QStringListinstead of a QString. This change makes searching the required information a lot easierthan scanning a long string.

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

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

    Changes to Qt SQL

    QSqlQueryModel::indexInQuery() is virtual now.

    QSqlQueryModel::setQuery() emits fewer signals. The modelAboutToBeReset() andmodelReset() signals are sufficient to inform views that they must re-interrogate themodel.

    QSqlDriver::subscribeToNotification(), QSqlDriver::unsubscribeFromNotification(), 

    http://doc.qt.io/qt-5/qsqldriver.html#isIdentifierEscapedhttp://doc.qt.io/qt-5/qsqldriver.html#isIdentifierEscapedhttp://doc.qt.io/qt-5/qsqldriver.html#subscribedToNotificationshttp://doc.qt.io/qt-5/qsqldriver.html#unsubscribeFromNotificationhttp://doc.qt.io/qt-5/qsqldriver.html#subscribeToNotificationhttp://doc.qt.io/qt-5/qsqlquerymodel.html#setQueryhttp://doc.qt.io/qt-5/qsqlquerymodel.html#indexInQueryhttp://doc.qt.io/qt-5/qsslcertificate.html#subjectAlternativeNameshttp://doc.qt.io/qt-5/qsslcertificate-obsolete.html#alternateSubjectNameshttp://doc.qt.io/qt-5/qsslcertificate.html#isBlacklistedhttp://doc.qt.io/qt-5/qsslcertificate-obsolete.html#isValidhttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qstringlist.htmlhttp://doc.qt.io/qt-5/qsslcertificate.html#issuerInfohttp://doc.qt.io/qt-5/qsslcertificate.html#subjectInfohttp://doc.qt.io/qt-5/qnetworkconfiguration.html#bearerTypeNamehttp://doc.qt.io/qt-5/qtcpserver.html#incomingConnectionhttp://doc.qt.io/qt-5/qabstractsocket.html#disconnectFromHosthttp://doc.qt.io/qt-5/qabstractsocket.html#connectToHosthttps://codereview.qt-project.org/#/admin/projects/qt/qthttphttps://codereview.qt-project.org/#/admin/projects/qt/qtftphttp://doc.qt.io/qt-5/qnetworkaccessmanager.htmlhttp://doc.qt.io/qt-5/qnetworkaccessmanager.htmlhttp://doc.qt.io/qt-5/qssl.html#SslProtocol-enumhttp://doc.qt.io/qt-5/qprinter.htmlhttp://doc.qt.io/qt-5/qprintengine.html#PrintEnginePropertyKey-enumhttp://doc.qt.io/qt-5/qprintdialog.html

  • 8/17/2019 C++ API changes Qt 5

    17/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 17

    QSq Dr ver::su scr e ToNot cat ons(), QSq Dr ver:: sI ent erEscape (), anQSqlDriver::stripDelimiters() are virtual now. The corresponding xxxImplementationfunctions are also removed as the subclasses of QSqlDriver can re-implement thosedirectly.

    QSqlError now handles alphanumeric error codes that are used by QPSQL. The numericcodes are deprecated.

    Changes to Qt Test

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

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

    The QTEST_NOOP_MAIN macro is removed. If a test appears to be inapplicable for aparticular build at compile-time, it should be omitted either using the .pro file logic or callQSKIP in the initTestCase() method to skip the entire test. If you're using the laterapproach, report a meaningful explanation in the test log.

    The DEPENDS_ON macro is removed as it misled some users to believe that they couldmake test functions depend on each other or impose an execution order on testfunctions.

    QTest::qt_snprintf()  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 mustbe replaced with QByteArray::qsnprintf().

    c{QTest::pixmapsAreEqual()} is removed. Comparison of QPixmap objects must be doneusing the QCOMPARE macro, which provides more informative output in the event of afailure.

    The "mode" parameter in QSKIP macro is removed. This parameter caused problems intest metrics calculation because of the SkipAll mode, which hid information about theskipped test data. Calling QSKIP in a test function now behaves like SkipSingle, which isskipping 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.

    qCompare() has been replaced by overloading. Code such as qCompare(l,r) no longer uses the QString-specific implementation and may fail to compile. Werecommend that you replace specialization with overloading. Also, rather than passexplicit template arguments to qCompare, let the overload resolution pick the correctone, and cast arguments in case of ambiguous overloads (for example,qCompare(QString(l), r)). The resulting code will continue to work against olderQtTestlib versions.

    QTest::qWaitForWindowShown()  is replaced with QTest::qWaitForWindowExposed().

     

    http://doc.qt.io/qt-5/qtest.html#qWaitForWindowExposedhttp://doc.qt.io/qt-5/qstring.htmlhttp://doc.qt.io/qt-5/qpixmap.htmlhttp://doc.qt.io/qt-5/qbytearray.html#qsnprintf#bytearray-qsnprintfhttp://doc.qt.io/qt-5/qttest-qmlmodule.htmlhttp://doc.qt.io/qt-5/qttest-qmlmodule.htmlhttp://doc.qt.io/qt-5/qsqlerror.htmlhttp://doc.qt.io/qt-5/qsqldriver.htmlhttp://doc.qt.io/qt-5/qsqldriver.html#stripDelimitershttp://doc.qt.io/qt-5/qsqldriver.html#isIdentifierEscapedhttp://doc.qt.io/qt-5/qsqldriver.html#subscribedToNotifications

  • 8/17/2019 C++ API changes Qt 5

    18/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 18

    Changes to Qt OpenGL

    Apart from the QGLWidget class, the Qt OpenGL module should not be used for new code.

    Instead, use the corresponding OpenGL classes in Qt GUI.

    QGLPixelBuffer is deprecated and implemented by using a hidden QGLWidget and aQOpenGLFramebufferObject. For offscreen rendering to a texture, switch to usingQOpenGLFramebufferObject directly to improve performance.

    The default major version of QGLFormat is changed to 2 to align it with QSurfaceFormat.Applications that want to use a different version, should explicitly request it usingQGLFormat::setVersion().

    QGLContext::generateFontDisplayLists()  andQGLWidget::fontDisplayListBase()  are removed.

    The listBase parameter is removed from QGLWidget::renderText() functions.

    To ensure support on more platforms, stricter requirements have been introduced for

    doing threaded OpenGL. First, you must call QGLWidget::makeCurrent() at least once pereach QGLWidget::swapBuffers() call, so that the platform has a chance to synchronizeresizing the OpenGL surface. Second, before calling QGLWidget::makeCurrent() orQGLWidget::swapBuffers() in a separate thread, you must callQGLContext::moveToThread() to explicitly let Qt know in which thread a QGLContext iscurrently being used. You also need to make sure that the context is not current in thecurrent thread before moving it to a different thread.

    Changes to Qt Global

    qMacVersion() is removed. Use QSysInfo::macVersion() or QSysInfo::MacintoshVersioninstead.

    Qt::escape() is deprecated. Use QString::toHtmlEscaped() instead.

    qIsDetached is removed, becauses it is irrelevant for multi-threaded applications.There is no replacement for this function.

    Changes to ToolsThe qttest_p4.prf file is removed. Use CONFIG+=testcase  and other flags instead.

    The -dwarf2 configure argument is removed. DWARF2 is always used on OS X now.

    Configure no longer calls qmake -recursive by default, because the subsequent buildinvokes qmake as needed. Use -fully-process to restore the old behavior.

    The lupdate CODECFORTR variable is deprecated, because source code written with Qt 5 isexpected to use UTF-8 encoding.

    http://doc.qt.io/qt-5/linguist-manager.html#using-lupdatehttp://doc.qt.io/qt-5/qstring.html#toHtmlEscapedhttp://doc.qt.io/qt-5/qsysinfo.html#MacintoshVersion-varhttp://doc.qt.io/qt-5/qsysinfo.html#macVersionhttp://doc.qt.io/qt-5/qglcontext.htmlhttp://doc.qt.io/qt-5/qglcontext.html#moveToThreadhttp://doc.qt.io/qt-5/qglwidget.html#swapBuffershttp://doc.qt.io/qt-5/qglwidget.html#makeCurrenthttp://doc.qt.io/qt-5/qglwidget.html#swapBuffershttp://doc.qt.io/qt-5/qglwidget.html#makeCurrenthttp://doc.qt.io/qt-5/qglwidget.html#renderTexthttp://doc.qt.io/qt-5/qglformat.html#setVersionhttp://doc.qt.io/qt-5/qsurfaceformat.htmlhttp://doc.qt.io/qt-5/qglformat.htmlhttp://doc.qt.io/qt-5/qopenglframebufferobject.htmlhttp://doc.qt.io/qt-5/qopenglframebufferobject.htmlhttp://doc.qt.io/qt-5/qglwidget.htmlhttp://doc.qt.io/qt-5/qglpixelbuffer.htmlhttp://doc.qt.io/qt-5/qtgui-index.htmlhttp://doc.qt.io/qt-5/qtopengl-index.htmlhttp://doc.qt.io/qt-5/qglwidget.html

  • 8/17/2019 C++ API changes Qt 5

    19/20

    10/10/2015 C++ API changes | Qt 5.5

    http://doc.qt.io/qt-5/sourcebreaks.html 19

    Download

    Start for Free

    Qt for Application Development

    Qt for Device Creation

    Qt Open Source

    Terms & Conditions

    Licensing FAQ

    Product

    Qt in Use

    Qt for Application Development

    Qt for Device Creation

    Commercial Features

    Qt Creator IDE

    Qt Quick

    Services

    Technology Evaluation

    Proof of Concept

    Design & Implementation

    Productization

    Qt Training

    Partner Network

    Developers

    Documentation

    Examples & Tutorials

    Development Tools

    Wiki

    Forums

    Contribute to Qt

    About us

    Training & Events

    Resource Center

    News

    Careers

    Locations

    Contact Us

    14k

    Follow   16.7K followers

    Related Topics

    New Classes and Functions in Qt 5.5

    New Classes and Functions in Qt 5.4

    New Classes and Functions in Qt 5.3

    New Classes and Functions in Qt 5.2

    New Classes and Functions in Qt 5.1

    © 2015 The Qt Company Ltd. Documentation contributions included herein are the

    copyrights of their respective owners. The documentation provided herein is

    licensed under the terms of the GNU Free Documentation License version 1.3 aspublished by the Free Software Foundation. Qt and respective logos are trademarks

    of The Qt Company Ltd. in Finland and/or other countries worldwide. All other

    trademarks are property of their respective owners.

    http://www.gnu.org/licenses/fdl.htmlhttp://doc.qt.io/qt-5/newclasses51.htmlhttp://doc.qt.io/qt-5/newclasses52.htmlhttp://doc.qt.io/qt-5/newclasses53.htmlhttp://doc.qt.io/qt-5/newclasses54.htmlhttp://doc.qt.io/qt-5/newclasses55.htmlhttps://twitter.com/intent/user?original_referer=http%3A%2F%2Fdoc.qt.io%2Fqt-5%2Fsourcebreaks.html&region=count_link&screen_name=qtproject&tw_p=followbuttonhttps://twitter.com/intent/follow?original_referer=http%3A%2F%2Fdoc.qt.io%2Fqt-5%2Fsourcebreaks.html&region=follow_link&screen_name=qtproject&tw_p=followbuttonhttp://qt.io/about-us/http://qt.io/contact-ushttp://qt.io/locations/http://qt.io/careers/http://qt.io/news/http://qt.io/resource-center/http://qt.io/events/http://qt.io/about-us/http://wiki.qt.io/contributehttp://forum.qt.io/http://wiki.qt.io/http://doc.qt.io/qt-5/topics-app-development.htmlhttp://doc.qt.io/qt-5/qtexamplesandtutorials.htmlhttp://doc.qt.io/http://qt.io/developers/https://qt.io/partners/http://qt.io/qt-training/http://qt.io/services-productization/http://qt.io/services-design-implementation/http://qt.io/services-proof-of-concept/http://qt.io/services-technology-evaluation/http://qt.io/services/http://qt.io/qt-quick/http://qt.io/ide/http://qt.io/qt-features/http://qt.io/qt-for-device-creation/http://qt.io/application-development/http://qt.io/product/http://qt.io/product/http://qt.io/FAQ/http://qt.io/terms-conditions/http://qt.io/download-open-source/http://qt.io/request-eval-for-devices-step-2/http://qt.io/download-eval-for-applications-step-2/http://qt.io/download/http://qt.io/download/

  • 8/17/2019 C++ API changes Qt 5

    20/20

    10/10/2015 C++ API changes | Qt 5.5

    Sign In Feedback Contact us © 2015 The Qt Company

    http://qt.io/about-us/http://qt.io/contact-us/mailto:[email protected]?Subject=Feedback%20about%20doc.qt.io%20sitehttps://account.qt.io/login