source-breaks.qdoc 29.59 KiB
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
****************************************************************************/
/*!
\page sourcebreaks.html
\title C++ API changes
\brief Lists the source incompatible API changes in Qt 5.
Qt 5 introduces some source incompatible changes. Here we list the important ones, but you can find the complete list in
\c {<Qt 5 Install Dir>/qtbase/dist/changes-5.0.0}.
The following sections lists the API changes in each module and provides recommendations to handle those changes.
\section1 Changes to Qt Core
    \list
     \li The \l{QObject::connectNotify()} and \l {QObject::disconnectNotify()} functions now need a \l{QMetaMethod} argument
         that identifies the signal, rather than a \c{const char} pointer.
     \li \l{QLibrary::resolve()} now returns a function pointer instead of \c{void} pointer.
     \li \c{QLibraryInfo::buildKey()} and the corresponding \c{QT_BUILD_KEY} macro are removed.
         You must remove all references to this function and macro, as build key is not necessary now.
     \li \l{QCoreApplication::translate()} no longer returns the source text if the translation is empty.
         Use the Qt Linguist Release tool (\c{lrelease -removeidentical}) instead for optimization.
     \li The \l{QTranslator::translate()} function signature is changed to set the default value of \c{n} to -1.
          We recommend you to update the implementation of this virtual function in your sources.
     \li \l{QString} and \l{QByteArray} constructors now use a negative size to indicate that the string passed is null-terminated (a null-terminated array of \l{QChar},
         in the case of QString). In Qt 4, negative sizes were ignored, which resulted in empty \l{QString} and \l{QByteArray}. The size argument now
         has a default value of -1, replacing the separate constructors that did the same.
     \li \c{QBool} is removed. In Qt 4, \l{QString::contains()}, \l{QByteArray::contains()}, and \l{QList::contains()}
         returns an internal \c{QBool} type so that the Qt3 code "if (a.contains() == 2)" would not compile anymore.
         If your code uses \c{QBool}, replace it with \c{bool}.
     \li \l{QMetaType} has undergone the following changes:
      \list
       \li \c{QMetaType::construct()} is renamed as \l{QMetaType::create()}.
       \li \c{QMetaType::unregisterType()} is removed.
       \li \l{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 \l{Qt Script} this
            means \l{QScriptValue::isQObject()} can be true, where it was false before.
       \li \c{QMetaType::QWidgetStar} is removed. Use \l{qMetaTypeId()}{qMetaTypeId<QWidget*>()}
           or \l{QVariant::canConvert()}{QVariant::canConvert<QWidget*>()} instead.
       \li \c{Q_DECLARE_METATYPE(type)} now requires \c{type} to be fully defined.
           This means, \c{Q_DECLARE_METATYPE(QSharedPointer<t>)} and \c{Q_DECLARE_METATYPE(QWeakPointer<t>)}
           also need \c{type} to be fully defined.
           In cases where a forward declared type is needed as a meta-type, use \c{Q_DECLARE_OPAQUE_POINTER(type)}.
      \endlist
     \li \l{QMetaMethod} has undergone the following changes:
      \list
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
\li \c{QMetaMethod::signature()} is renamed as \l{QMetaMethod::methodSignature()}, and the return type is changed to \l{QByteArray}. This change is to enable generating the signature string on demand, rather than storing it in the meta-data. \li \l{QMetaMethod::typeName()} no longer returns an empty string if the return type is \c{void}, instead it returns \c{"void"}. The recommended way of checking whether a method returns \c{void} is to compare the return value of \l{QMetaMethod::returnType()} with \l{QMetaType::Void}. \endlist \li The \l{QVariant} constructor which takes \l{Qt::GlobalColor} argument is removed. Code constructing such variants must explicitly call \l{QColor} constructor now. For example, instead of \c{"QVariant(Qt::red)"}, use \c{"QVariant(QColor(Qt::red))"} to create a \l{QVariant} instance. \li \l{QAbstractEventDispatcher} has undergone the following changes: \list \li The signature for the pure-virtual \c{registerTimer()} function is changed. All subclasses of \l{QAbstractEventDispatcher} must re-implement the function with this new signature: \code virtual void registerTimer(int timerId, int interval,Qt::TimerType timerType, QObject *object) = 0; \endcode \li QAbstractEventDispatcher::TimerInfo is no longer a \c{typedef} of \c{QPair<int, int>}. It is now a \c{struct} with 3 members: \c{int timerId}, \c{int interval}, and \c{Qt::TimerType timerType}. Update the \c{QAbstractEventDispatcher::registeredTimers} function with this change. \endlist \li The \c{QUuid::operator QString()} implicit conversion operator is removed. Use the \l{QUuid::toString()} function instead. \li \l{QProcess::ForwardedChannels} no longer forwards the output to the GUI applications on the Windows platform, unless those applications creates a console. \li \c{QDir} has undergone the following changes: \list \li The \c{convertSeparators()} function is removed. Use \l{QDir::toNativeSeparators()} instead. \li The \c{QDir::NoDotAndDotDot} enum value is removed. Use \l{QDir::NoDot} or \l{QDir::NoDotDot} instead. \endlist \li \c{QTextCodecPlugin} is removed as all the text codecs are part of Qt Core now. \li \c{QFSFileEngine}, \c{QAbstractFileEngine}, \c{QAbstractFileEngineIterator}, and \c{QAbstractFileEngineHandler} are no longer public. We recommend you to avoid using these classes as there is no compatibility promise. \li The \l{QLocale::toShort()}, \l{QLocale::toUShort()}, \l{QLocale::toInt()}, \l{QLocale::toUInt()}, \l{QLocale::toLongLong()}, and \l{QLocale::toULongLong()} functions no longer take the argument for base. They localize base 10 conversions. To convert other bases, use the \l{QString} functions instead. \li \c{QSystemLocale} is not public anymore. Use \l{QLocale} instead. \li The \c{QChar::NoCategory} enum value is removed. The \l{QChar::Other_NotAssigned} enum value is returned for unassigned codepoints now. \li \l{QAbstractItemModel} has undergone the following changes: \list \li \l{QAbstractItemModel::beginMoveRows()}{beginMoveRows()} no longer emits the \c{layoutAboutToBeChanged} signal, and \l{QAbstractItemModel::endMoveRows()}{endMoveRows()} no longer emits the \c{layoutChanged} signal. All proxy models must connect to (and disconnect from) the \c{rowsAboutToBeMoved} and \c{rowsMoved} signals. \li \l{QAbstractItemModel::sibling()} is virtual now to allow implementations to optimize based on internal data. \li \l{QAbstractItemModel::createIndex()} method now only provides the void* and quintptr overloads, making calls with a literal \c 0 (createIndex(row, col, 0)) ambiguous. Either cast (quintptr(0)) or omit the third argument(to get the void* overload). \endlist \li \l{QAbstractItemModel::setRoleNames()} is deprecated. Use \l{QAbstractItemModel::roleNames()} instead. \l{QAbstractItemModel::roleNames()} is virtual now to allow a consistent API with the rest of QAbstractItemModel. Reimplementing the virtual methods to provide the elements is preferred to setting those directly. \li Default value of the \l{QSortFilterProxyModel::dynamicSortFilter} property is changed to \c{true}. \li \l{QString::mid()}, \l{QString::midRef()}, and \l{QByteArray::mid()} now return an empty \c{QString}, \c{QStringRef}, and \c{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 \c{QString} or a null \c{QStringRef}. \li The following \l{QString} functions use the C locale instead of the default or system locale: \list \li \l{QString::toLongLong()}{toLongLong()} \li \l{QString::toULongLong()}{toULongLong()} \li \l{QString::toLong()}{toLong()} \li \l{QString::toULong()}{toULong()} \li \l{QString::toInt()}{toInt()} \li \l{QString::toUInt()}{toUInt()} \li \l{QString::toShort()}{toShort()} \li \l{QString::toUShort()}{toUShort()} \li \l{QString::toDouble()}{toDouble()} \li \l{QString::toFloat()}{toFloat()} \endlist
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
This is to guarantee consistent default conversion of strings. For locale-aware conversions use the equivalent \l{QLocale} functions. \li QDate, QTime, and QDateTime has undergone the following important behavioral changes: \list \li 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. \li \l{QDate::setYMD()} is deprecated, use \l{QDate::setDate()} instead. \li Adding days to a null QDate or seconds to a null QTime will no longer return a valid QDate/QTime. \li The \l{QDate::addDays()} and QDateTime::addDays() functions now takes a \c{qint64} argument, and the \l{QDate::daysTo()} and \l{QDateTime::daysTo()} functions now returns a \c{qint64} value. \endlist \li \l{QTextCodec} has undergone the following changes: \list \li \c{QTextCodec::codecForCStrings()} and \c{QTextCodec::setCodecForCStrings()} are removed as they were creating uncertainty/bugs in using QString easily and (to a lesser extent) performance issues. \li \c{QTextCodec::codecForTr()} and \c{QTextCodec::setCodecForTr()} are removed. \endlist \li \l{QObject::trUtf8()} and \c{QCoreApplication::Encoding} are deprecated. Qt assumes that the source code is encoded in UTF-8. \li \l{QFile::setEncodingFunction()} and \l{QFile::setDecodingFunction()} are deprecated. The \l{QFile::encodeName()} and \l{QFile::decodeName()} functions are now hard-coded to operate on \l{QString::fromLocal8Bit()} and \l{QString::toLocal8Bit()} only. The old behavior is still possible using \l{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. \li \c{QEvent::AccessibilityPrepare}, {QEvent::AccessibilityHelp}, and \c{QEvent::AccessibilityDescription} are removed. \li \c{QCoreApplication::setEventFilter()} and \c{QApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilter} are replaced with \l{QCoreApplication::installNativeEventFilter()} and \l{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 \c{xcb_generic_event_t} due to the switch to XCB, which requires porting the application code to XCB as well. \li \l{qDebug()}, \l{qWarning()}, \l{qCritical()}, and \l{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 \c{QT_MESSAGE_PATTERN} environment variable. \l{qInstallMsgHandler()} is deprecated, so we recommend using \l{qInstallMessageHandler()} instead. \li \l{QPointer} is changed to use \l{QWeakPointer}. The old guard mechanism has been removed, which causes a slight change in behavior when using \l{QPointer}. In earlier Qt version, if a \l{QPointer} is used on a \l{QWidget} (or a subclass of QWidget), the \l{QPointer} was cleared by the \l{QWidget} destructor. In Qt 5, the \l{QPointer} is cleared by the \l{QObject} destructor along with the \l{QWeakPointer}s. Any \l{QPointer}s tracking a widget is not cleared before the \l{QWidget} destructor destroys the children for the widget being tracked. \li \l{QUrl} changed considerably in Qt 5 to comply better with the URL specifications and with brokenness out there. \li \l{QUrl} setPath not longer handles relative path. They are by definition invalid. \li \l{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 \l{QUrl::toEncoded()} and \l{QUrl::fromEncoded()}). The most notable difference with this change is when dealing with \l{QUrl::toString()}. In earlier Qt version, this function would return percent characters in the URL, but now it returns "%25" like the \l{QUrl::toEncoded()} does. \li \l{QUrl} no longer has functions that handle individual query items and query delimiters, such as \c addQueryItem() and \c queryPairDelimiter(). These have been moved to the new \l{QUrlQuery} class. \li \l{Qt::WFlags} is deprecated, use \l{Qt::WindowFlags} instead. This typedef dates from the Qt 1 days, and such abbreviations are not current Qt style. \li \l{Qt::HANDLE} typedef is now defined as \c{void *} on all platforms. \endlist \section1 Changes to Qt GUI \list \li \l{QPainter} does not support uniting clipped regions anymore. Use \l{QRegion::united()} instead to unite clips and pass the result to \l{QPainter}. \li \l{QPen} now has a default width of 1 instead of 0. Thus, it is no longer \l{QPen::isCosmetic()}{cosmetic} by default. \li \l{QAccessibleInterface} has undergone the following changes: \list \li The "child" integer parameters are removed to bring it more closer to \c{IAccessible2}, and this means the following functions lose the integer parameter: \list \li text(Text t, int child) is now \l{QAccessibleInterface::text()}{text(Text t)} \li rect(int child) is now \l{QAccessibleInterface::rect()}{rect()} \li setText(Text t, int child, const QString &text) is now \l{QAccessibleInterface::setText()}{setText(Text t, const QString &text)} \li role(int child) is now \l{QAccessibleInterface::role()}{role()} \li state(int child) is now \l{QAccessibleInterface::state()}{state()} \endlist \li \c{navigate()} is replaced with \l{QAccessibleInterface::parent()}{parent()} and \l{QAccessibleInterface::child()}{child()} to navigate the hierarchy. \li \c{relationTo()} is replaced with \l{QAccessibleInterface::relations()}{relations()}.
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
\li \c{QAccessibleInterface::userActionCount()}, \c{QAccessibleInterface::actionText()}, and \c{QAccessibleInterface::doAction()} are removed. We recommend the \l{QAccessibleInterface} subclasses to implement the \l{QAccessibleActionInterface} instead. \endlist \li The constructor of \l{QAccessibleEvent} does not need the \c{child} parameter anymore, and the corresponding \c{QAccessibleEvent::child()} function is removed. \li The constructor of \l{QTabletEvent} does not need the \c{hiResGlobalPos} argument anymore, as all coordinates are floating point-based now. \li \l{QTouchEvent} has undergone the following changes: \list \li The \l{QTouchEvent::DeviceType}{DeviceType} enum and \c{QTouchEvent::deviceType}{deviceType()} function are deprecated as \l{QTouchDevice} provides a better way to identify and access the device from which the events originate. \li The constructor now takes a \l{QTouchDevice} pointer instead of \c{DeviceType} value. \li \c{QTouchEvent::TouchPoint::isPrimary()} is removed. \li \c{QWidget *widget()} is replaced with \c {QObject *target()} to avoid \l{QWidget} dependencies. \li \l{QEvent::TouchCancel} is introduced to use it on systems where it makes sense to differentiate between a regular \l{QEvent::TouchEnd} and abrupt touch sequence cancellations caused by the compositor. For example, when a swype gesture is recognized. \endlist \li \c{QIconEngineV2} is now merged into \l{QIconEngine}. Update your sources to use \c{QIconEngine} instead of \c{QIconEngineV2}. \li \l{QSound} is moved to Qt Multimedia from Qt GUI. \li \l{QImage::fill()} on an image with format \c{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. \li \c QDesktopServices::storageLocation() and \c QDesktopServices::displayName() are replaced by \l{QStandardPaths::writableLocation()} and \l{QStandardPaths::displayName()} respectively. They are now in the \l{Qt Core} module. Make sure to read the \l{QDesktopServices::storageLocation()} documentation when porting from \l{QDesktopServices::DataLocation}. \li \c QPixmap::grabWindow() and \c QPixmap::grabWidget() are removed. Use \l{QScreen::grabWindow()} instead. \li QMotifStyle, QPlastiqueStyle, QCleanlooksStyle, and QCDEStyle are replaced with a new style, QFusionStyle. If your application depends on any of these removed styles, you can either use the \l{http://qt.gitorious.org/qt/qtstyleplugins}{qtstyleplugins} project to get these styles or update your application to use the new fusion style. For more details about this change, see \l{https://blog.qt.digia.com/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/}. \li The session management API has been simplified. commitData() has been obsoleted and removed. The signal \l{QGuiApplication::commitDataRequest()} replaces it. Q(Gui)Application will emit this signal from 5.2 onward on supported platforms (Linux and Windows) \endlist \section1 Changes to Qt Widgets \list \li The signatures of \l{QItemEditorFactory::createEditor()} and \l{QItemEditorFactory::valuePropertyName()} are changed to take arguments of type \c{int} instead of \l{QVariant::Type}. \li \c{QInputContext} is removed as related getter and setter functions in \l{QWidget} and \l{QApplication} are removed. Input contexts are now platform-specific. \li \c QApplication::setGraphicsSystem() is removed as the introduction of \l{Qt Platform Abstraction}{QPA} made it redundant. \li \l{QInputDialog::getInteger()} is deprecated. Use \l{QInputDialog::getInt()} instead. \li \c{QStyle::standardIconImplementation()} and \c{QStyle::layoutSpacingImplementation()} are removed, and the \l{QStyle::standardIcon()} and \l{QStyle::layoutSpacing()} functions are made pure virtual now. The removed functions were introduced in Qt 4 for binary compatibility reasons. \li The \c{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. \li The following functions of \l{QHeaderView} are deprecated: \list \li \c{void setMovable(bool movable)} - Use \l{QHeaderView::setSectionsMovable()} instead. \li \c{bool isMovable() const} - Use \l{QHeaderView::sectionsMovable()} instead. \li \c{void setClickable(bool clickable)} - Use \l{QHeaderView::setSectionsClickable()} instead. \li \c{bool isClickable() const} - Use \l{QHeaderView::sectionsClickable()} instead. \li \c{void setResizeMode(int logicalindex, ResizeMode mode)} - Use \l{QHeaderView::setSectionResizeMode()} instead. \li \c{ResizeMode resizeMode(int logicalindex) const} - Use \l{QHeaderView::sectionResizeMode()} instead. \endlist \li \l{QGraphicsItem} and its derived classes can no longer pass a \l{QGraphicsScene} to the item's constructor. Construct the item without a scene and call \l{QGraphicsScene::addItem()} to add the item to the scene. \li \l{QAbstractItemView} has undergone the following changes: \list \li The derived classes now emit the \c{clicked()} signal on the left mouse click only, instead of all mouse clicks. \li The virtual \l{QAbstractItemView::dataChanged()} function signature now includes the roles that has changed. The signature is consistent with the \c{dataChanged()} signal in the model. \endlist \li \c{QProxyModel} is removed. Use \l{QAbstractProxyModel} and the related classes instead. A copy of \c{QProxyModel}
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
is available in the \l{http://qt-project.org/wiki/Qt-5-UI-Helpers}{Ui Helpers} repository. \li \l{QColorDialog::customColor()} now returns a \l{QColor} value instead of \c{QRgb}. \li The \l{QColorDialog::setCustomColor()} and \l{QColorDialog::setStandardColor()} functions now need a \l{QColor} value as their second parameter instead of \c{QRgb}. \endlist \section1 Changes to Qt WebKit \list \li The WebKit module in Qt is now split in two modules, \c{webkit} and \c{webkitwidgets}, in order to allow the dependency of the \c{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 \c{webkitwidgets} module adds the \c{webkit} module automatically to the project, so in your application's project file, \c{QT += webkit} should now be modified to: \code QT += webkitwidgets \endcode \li The same applies to the module include, \c{#include <QtWebKit/QtWebKit>} should be modified to: \code #include <QtWebKitWidgets/QtWebKitWidgets> \endcode \li A consequence of the module split is that classes of the \l{Qt WebKit} 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: \code #include <QWebPage> \endcode The include path will take care of selecting the right module. \li The qwebkitversion.h header has been renamed to q\b{t}webkitversion.h to match other Qt modules, and part of its contents has been moved to qwebkitglobal.h. \c{#include <qwebkitversion.h>} should be replaced with two includes: \code #include <qtwebkitversion.h> #include <qwebkitglobal.h> \endcode \endlist \section1 Changes to Qt Print Support \list \li The \c{QPageSetupDialog::PageSetupDialogOption} enum and the corresponding set and get functions, \c{QPageSetupDialog::options()} and \c{QPageSetupDialog::setOptions()} are removed. \li Support for printing PostScript files has been removed. \endlist \section1 Changes to Qt Network \list \li The \l{QSslCertificate::subjectInfo()} and \l{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. \li \l{QSslCertificate::isValid()} is deprecated. Use \l{QSslCertificate::isBlacklisted()} instead to avoid binary breaks in the future. \li \l{QSslCertificate::alternateSubjectNames()} is deprecated. Use \l{QSslCertificate::subjectAlternativeNames()} instead. \li The \c{QSsl::TlsV1} enum value is renamed as \l{QSsl::TlsV1_0}. \li The \c{QFtp}, \c{QUrlInfo}, \c{QHttp} classes are not public anymore. Use \l{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 \c{QFtp} and \c{QHttp} classes as they existed in Qt 4. \li The \l{QAbstractSocket::connectToHost()} and \l{QAbstractSocket::disconnectFromHost()} functions are virtual now, and \c{QAbstractSocket::connectToHostImplementation()} and \c{QAbstractSocket::disconnectFromHostImplementation()} are removed. \li The \l{QTcpServer::incomingConnection()} function now takes an argument of type \c{qintptr} instead of an \c{int}. \li \c{QNetworkConfiguration::bearerName()} is removed. Use the \l{QNetworkConfiguration::bearerTypeName()}{bearerTypeName()} instead. \endlist \section1 Changes to Qt SQL \list \li \l{QSqlQueryModel::indexInQuery()} is virtual now. \li \l{QSqlQueryModel::setQuery()} emits fewer signals. The \c{modelAboutToBeReset()} and \c{modelReset()} signals are sufficient to inform views that they must re-interrogate the model. \li The \l{QSqlDriver::subscribeToNotification()}, \l{QSqlDriver::unsubscribeFromNotification()}, \l{QSqlDriver::subscribedToNotifications()}, \l{QSqlDriver::isIdentifierEscaped()}, and \l{QSqlDriver::stripDelimiters()} functions are virtual now. The corresponding \c xxxImplementation functions are also removed as the subclasses of \l{QSqlDriver} can re-implement those directly. \endlist \section1 Changes to Qt Test
351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
The following source incompatible changes are made in this module: \list \li 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. \li The \c{QTRY_VERIFY} and \c{QTRY_COMPARE} macros are now part of \c{QTestLib}. These macros were part of \c{tests/shared/util.h} earlier, but now they are part of the <QtTest/QtTest> header. In addition, \c{QTRY_VERIFY_WITH_TIMEOUT} and \c{QTRY_COMPARE_WITH_TIMEOUT} are provided to specify custom timeout values. \li The \c{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 \c{QSKIP} in the \c{initTestCase()} method to skip the entire test. If you're using the later approach, report a meaningful explanation in the test log. \li The \c{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. \li The \c{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 \c{QByteArray::qsnprintf()}. \li The \c{QTest::pixmapsAreEqual()} function is removed. Comparison of \l{QPixmap} objects must be done using the \c{QCOMPARE} macro, which provides more informative output in the event of a failure. \li The \c{"mode"} parameter in \c{QSKIP} macro is removed. This parameter caused problems in test metrics calculation because of the \c{SkipAll} mode, which hid information about the skipped test data. Calling \c{QSKIP} in a test function now behaves like \c{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. \li \c QTest::qWaitForWindowShown() is replaced with \l{QTest::qWaitForWindowExposed()}. \endlist \section1 Changes to Qt Global The following source incompatible changes are made: \list \li \c{qMacVersion()}: This global function is removed. Use \l{QSysInfo::macVersion()} or \l{QSysInfo::MacintoshVersion} instead. \li \c{Qt::escape()}: This global function is deprecated. Use \l{QString::toHtmlEscaped()} instead. \li \c{qIsDetached<>}: This global function is removed as it is not relevant anymore for multi-threaded applications. There is no replacement for this function. \endlist \section1 Changes to Tools \list \li Avoid using \c{qttest_p4.prf} file. We recommend that you explicitly enable the preferences you want. Autotest \c{.pro} files must stop using \c{'load(qttest_p4)'} and use \c{'CONFIG+=testcase'} instead. \li The \c{-dwarf2} configure argument is removed. DWARF2 is always used on Mac OS X now. \endlist \section1 Related Topics \list \li \l{New Classes and Functions in Qt 5.2} \li \l{New Classes and Functions in Qt 5.1} \endlist */