Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > f93881942bd3805980c2fe63aa853d78 > files > 257

qtdoc5-5.9.4-1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- source-breaks.qdoc -->
  <title>C++ API changes | Qt 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.9</a></td><td >C++ API changes</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#changes-to-qt-core">Changes to Qt Core</a></li>
<li class="level2"><a href="#changes-to-qaction">Changes to QAction</a></li>
<li class="level2"><a href="#changes-to-qchar">Changes to QChar</a></li>
<li class="level2"><a href="#changes-to-qcoreapplication">Changes to QCoreApplication</a></li>
<li class="level2"><a href="#changes-to-qevent">Changes to QEvent</a></li>
<li class="level2"><a href="#changes-to-qfile">Changes to QFile</a></li>
<li class="level2"><a href="#changes-to-qfont">Changes to QFont</a></li>
<li class="level2"><a href="#changes-to-qmetatype">Changes to QMetaType</a></li>
<li class="level2"><a href="#changes-to-qmetamethod">Changes to QMetaMethod</a></li>
<li class="level2"><a href="#changes-to-qobject">Changes to QObject</a></li>
<li class="level2"><a href="#changes-to-qvariant">Changes to QVariant</a></li>
<li class="level2"><a href="#changes-to-qabstracteventdispatcher">Changes to QAbstractEventDispatcher</a></li>
<li class="level2"><a href="#changes-to-qdir">Changes to QDir</a></li>
<li class="level2"><a href="#changes-to-qlocale">Changes to QLocale</a></li>
<li class="level2"><a href="#changes-to-qabstractitemmodel">Changes to QAbstractItemModel</a></li>
<li class="level2"><a href="#changes-to-qstring">Changes to QString</a></li>
<li class="level2"><a href="#changes-to-qdate-qtime-and-qdatetime">Changes to QDate, QTime, and QDateTime</a></li>
<li class="level2"><a href="#changes-to-qtextcodec">Changes to QTextCodec</a></li>
<li class="level2"><a href="#changes-to-qurl">Changes to QUrl</a></li>
<li class="level1"><a href="#changes-to-qt-concurrent">Changes to Qt Concurrent</a></li>
<li class="level1"><a href="#changes-to-qt-gui">Changes to Qt GUI</a></li>
<li class="level2"><a href="#changes-to-qaccessibleinterface">Changes to QAccessibleInterface</a></li>
<li class="level2"><a href="#changes-to-qimage">Changes to QImage</a></li>
<li class="level2"><a href="#changes-to-qpainter">Changes to QPainter</a></li>
<li class="level2"><a href="#changes-to-qtouchevent">Changes to QTouchEvent</a></li>
<li class="level1"><a href="#changes-to-qt-widgets">Changes to Qt Widgets</a></li>
<li class="level2"><a href="#changes-to-qapplication">Changes to QApplication</a></li>
<li class="level2"><a href="#changes-to-qstyle">Changes to QStyle</a></li>
<li class="level2"><a href="#changes-to-qheaderview">Changes to QHeaderView</a></li>
<li class="level2"><a href="#changes-to-qabstractitemview">Changes to QAbstractItemView</a></li>
<li class="level2"><a href="#changes-to-qcolordialog">Changes to QColorDialog</a></li>
<li class="level1"><a href="#changes-to-qt-webkit">Changes to Qt WebKit</a></li>
<li class="level1"><a href="#changes-to-qt-print-support">Changes to Qt Print Support</a></li>
<li class="level1"><a href="#changes-to-qt-network">Changes to Qt Network</a></li>
<li class="level2"><a href="#changes-to-qsslcertificate">Changes to QSslCertificate</a></li>
<li class="level1"><a href="#changes-to-qt-sql">Changes to Qt SQL</a></li>
<li class="level1"><a href="#changes-to-qt-test">Changes to Qt Test</a></li>
<li class="level1"><a href="#changes-to-qt-opengl">Changes to Qt OpenGL</a></li>
<li class="level1"><a href="#changes-to-qt-global">Changes to Qt Global</a></li>
<li class="level1"><a href="#changes-to-tools">Changes to Tools</a></li>
<li class="level1"><a href="#related-topics">Related Topics</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">C++ API changes</h1>
<span class="subtitle"></span>
<!-- $$$sourcebreaks.html-description -->
<div class="descr"> <a name="details"></a>
<p>Qt 5 introduces some source incompatible changes. Here we list some important ones, but you can find more complete lists in <code>&lt;Qt 5 Install Dir&gt;/qtbase/dist/changes-5.x&#x2e;x</code>.</p>
<p>The following sections list the API changes in each module and provide recommendations for handling those changes.</p>
<a name="changes-to-qt-core"></a>
<h2 id="changes-to-qt-core">Changes to Qt Core</h2>
<ul>
<li>QLibrary::resolve() now returns a function pointer instead of <code>void</code> pointer.</li>
<li><code>QLibraryInfo::buildKey()</code> and the corresponding <code>QT_BUILD_KEY</code> macro are removed. You must remove all references to this function and macro, as build key is not necessary now.</li>
<li>The QTranslator::translate() function signature is changed to set the default value of <code>n</code> to -1. We recommend you to update the implementation of this virtual function in your sources.</li>
<li><code>QBool</code> is removed. In Qt 4, QString::contains(), QByteArray::contains(), and QList::contains() returned an internal <code>QBool</code> type so that the Qt3 code <code>if (a.contains() == 2)</code> would not compile anymore. If your code uses <code>QBool</code>, replace it with <code>bool</code>.</li>
<li>The <code>QUuid::operator QString()</code> implicit conversion operator is removed. Use the QUuid::toString() function instead.</li>
<li>QProcess::ForwardedChannels no longer forwards the output to the GUI applications on the Windows platform, unless those applications create a console.</li>
<li><code>QSystemLocale</code> is not public anymore. Use QLocale instead.</li>
<li>Default value of the QSortFilterProxyModel::dynamicSortFilter property is changed to <code>true</code>.</li>
<li><code>QTextCodecPlugin</code> is removed as all the text codecs are part of Qt Core now.</li>
<li><code>QFSFileEngine</code>, <code>QAbstractFileEngine</code>, <code>QAbstractFileEngineIterator</code>, and <code>QAbstractFileEngineHandler</code> are no longer public. We recommend you to avoid using these classes as there is no compatibility promise.</li>
<li>qDebug(), qWarning(), qCritical(), and 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 <code>QT_MESSAGE_PATTERN</code> environment variable. qInstallMsgHandler() is deprecated, so we recommend using qInstallMessageHandler() instead.</li>
<li>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 a QPointer is used on a QWidget (or a subclass of QWidget), the QPointer was cleared by the QWidget destructor. In Qt 5, the QPointer is cleared by the QObject destructor along with the QWeakPointers. Any QPointer tracking a widget is not cleared before the QWidget destructor destroys the children for the widget being tracked.</li>
<li>Qt::WFlags is deprecated, use Qt::WindowFlags instead. This typedef dates from the Qt 1 days, and such abbreviations are not current Qt style.</li>
<li>Qt::HANDLE typedef is now defined as <code>void *</code> on all platforms.</li>
<li>The non-atomic convenience methods of QAtomicInt and QAtomicPointer (that is, <code>operator=</code>, <code>operator int</code>, <code>operator T*</code>, <code>operator!</code>, <code>operator==</code>, <code>operator!=</code>, and <code>operator-&gt;</code>) have been removed as they performed implicit loads and stores of unspecified memory ordering. Code dealing with loading and storing is expected to use <code>load()</code>, <code>loadAquire()</code>, <code>store()</code>, and <code>storeRelease()</code>, instead.</li>
<li>The return type of <code>QFlags&lt;Enum&gt;::operator int()</code> matches the enum's underlying type (signed or unsigned) instead of always being <code>int</code>. This allows QFlags over enums of the unsigned type (for example, Qt::MouseButton).</li>
<li>Because of major changes in the behavior of QTextBoundaryFinder::boundaryReasons(), the <code>StartWord</code> and <code>EndWord</code> enum values were replaced with the <code>StartOfItem</code> and <code>EndOfItem</code> values to enforce revision of the affected code.</li>
<li>A number of functions in &lt;QtAlgorithms&gt; are deprecated. Use the implementations available in the STL, as described in Porting Guidelines.</li>
<li><code>setSharable()</code> and <code>isSharable()</code> in Qt containers are deprecated and will be removed in Qt 6. You should not use them in new applications. If you used them in existing applications, even though they are not documented, you should port away from them.</li>
</ul>
<a name="changes-to-qaction"></a>
<h3 >Changes to QAction</h3>
<p>The Softkeys API is removed, so the following functions and enums are removed:</p>
<ul>
<li><code>QAction::setSoftKeyRole()</code></li>
<li><code>QAction::softKeyRole()</code></li>
<li><code>QAction::SoftKeyRole</code></li>
<li><code>Qt::WA_MergeSoftkeys</code></li>
<li><code>Qt::WA_MergeSoftkeysRecursively</code></li>
<li><code>Qt::WindowSoftkeysVisibleHint</code></li>
<li><code>Qt::WindowSoftkeysRespondHint</code></li>
</ul>
<a name="changes-to-qchar"></a>
<h3 >Changes to QChar</h3>
<ul>
<li><code>QChar::NoCategory</code> is removed. The QChar::Other_NotAssigned enum value is returned for unassigned codepoints now.</li>
<li>QChar::Joining and QChar::joining() are deprecated. Use the QChar::JoiningType enum and QChar::joiningType() function instead.</li>
</ul>
<a name="changes-to-qcoreapplication"></a>
<h3 >Changes to QCoreApplication</h3>
<ul>
<li>QCoreApplication::translate() no longer returns the source text if the translation is empty. Use the Qt Linguist Release tool (<code>lrelease -removeidentical</code>) instead for optimization.</li>
<li><code>QCoreApplication::setEventFilter()</code> and <code>QApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilter</code> are replaced with QCoreApplication::installNativeEventFilter() and QCoreApplication::removeNativeEventFilter() for an API much closer to QEvent filtering.<p><b>Note: </b>The native events that can be filtered this way depend on the <a href="qpa.html">QPA</a> backend chosen at runtime. On X11, XEvents are replaced with <code>xcb_generic_event_t</code> due to the switch to XCB, which requires porting the application code to XCB as well.</p></li>
<li><code>QCoreApplication::Type</code> and <code>QApplication::type()</code> are removed. These Qt 3 legacy application types did not match the application types available in Qt 5. Use <code>qobject_cast</code> instead to dynamically find out the exact application type.</li>
<li>QCoreApplication::hasPendingEvents and QAbstractEventDispatcher::hasPendingEvents are deprecated.</li>
</ul>
<a name="changes-to-qevent"></a>
<h3 >Changes to QEvent</h3>
<ul>
<li><code>QEvent::AccessibilityPrepare</code>, <code>QEvent::AccessibilityHelp</code>, and <code>QEvent::AccessibilityDescription</code> are removed.</li>
<li>QEvent::TouchCancel is introduced to use it on systems where it makes sense to differentiate between a regular QEvent::TouchEnd and abrupt touch sequence cancellations caused by the compositor. For example, when a swype gesture is recognized.</li>
</ul>
<a name="changes-to-qfile"></a>
<h3 >Changes to QFile</h3>
<ul>
<li>QFile::setEncodingFunction() and QFile::setDecodingFunction() are deprecated.</li>
<li>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 the new code should not make assumptions about the file system encoding and older code should remove such assumptions.</li>
</ul>
<a name="changes-to-qfont"></a>
<h3 >Changes to QFont</h3>
<ul>
<li><code>QFont::handle()</code> is removed.</li>
<li>QFont::rawName() and QFont::setRawName() are deprecated.</li>
</ul>
<a name="changes-to-qmetatype"></a>
<h3 >Changes to QMetaType</h3>
<ul>
<li><code>QMetaType::construct()</code> is renamed as QMetaType::create().</li>
<li><code>QMetaType::unregisterType()</code> is removed.</li>
<li>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 Qt Script this means QScriptValue::isQObject() can be <code>true</code>, where it was <code>false</code> before.</li>
<li><code>QMetaType::QWidgetStar</code> is removed. Use qMetaTypeId&lt;QWidget*&gt;() or QVariant::canConvert&lt;QWidget*&gt;() instead.</li>
<li><code>Q_DECLARE_METATYPE(type)</code> now requires <code>type</code> to be fully defined. This means, <code>Q_DECLARE_METATYPE(QSharedPointer&lt;t&gt;)</code> and <code>Q_DECLARE_METATYPE(QWeakPointer&lt;t&gt;)</code> also need <code>type</code> to be fully defined. In cases where a forward declared type is needed as a meta-type, use <code>Q_DECLARE_OPAQUE_POINTER(type)</code>.</li>
</ul>
<a name="changes-to-qmetamethod"></a>
<h3 >Changes to QMetaMethod</h3>
<ul>
<li><code>QMetaMethod::signature()</code> is renamed as QMetaMethod::methodSignature(), and the return type is changed to QByteArray. This change is to enable generating the signature string on demand, rather than storing it in the meta-data.</li>
<li>QMetaMethod::typeName() no longer returns an empty string if the return type is <code>void</code>, instead it returns <code>&quot;void&quot;</code>. The recommended way of checking whether a method returns <code>void</code> is to compare the return value of QMetaMethod::returnType() with QMetaType::Void.</li>
</ul>
<a name="changes-to-qobject"></a>
<h3 >Changes to QObject</h3>
<ul>
<li>QObject::connectNotify() and QObject::disconnectNotify() now need a QMetaMethod argument that identifies the signal, rather than a <code>const char</code> pointer.</li>
<li>QObject::trUtf8() and <code>QCoreApplication::Encoding</code> are deprecated. Qt assumes that the source code is encoded in UTF-8.</li>
</ul>
<a name="changes-to-qvariant"></a>
<h3 >Changes to QVariant</h3>
<ul>
<li>The QVariant constructor which takes Qt::GlobalColor argument is removed. Code constructing such variants must explicitly call QColor constructor now. For example, instead of <code>QVariant(Qt::red)</code>, use <code>QVariant(QColor(Qt::red))</code> to create a QVariant instance.</li>
<li>Implicit creation of QVariant objects from the enum values Qt::BrushStyle, Qt::PenStyle, and Qt::CursorShape has been removed. Create objects explicitly or use <code>static_cast&lt;int&gt;(Qt::SolidLine)</code> to create a QVariant of type <code>int</code> with the same value as the enum.</li>
</ul>
<a name="changes-to-qabstracteventdispatcher"></a>
<h3 >Changes to QAbstractEventDispatcher</h3>
<ul>
<li>The signature for the pure-virtual <code>registerTimer()</code> function is changed. All subclasses of QAbstractEventDispatcher must re-implement the function with this new signature:<pre class="cpp">

  <span class="keyword">virtual</span> <span class="type">void</span> registerTimer(<span class="type">int</span> timerId<span class="operator">,</span> <span class="type">int</span> interval<span class="operator">,</span><span class="type">Qt</span><span class="operator">::</span>TimerType timerType<span class="operator">,</span> <span class="type">QObject</span> <span class="operator">*</span>object) <span class="operator">=</span> <span class="number">0</span>;

</pre>
</li>
<li>QAbstractEventDispatcher::TimerInfo is no longer a <code>typedef</code> of <code>QPair&lt;int, int&gt;</code>. It is now a <code>struct</code> with 3 members: <code>int timerId</code>, <code>int interval</code>, and <code>Qt::TimerType timerType</code>. Update the QAbstractEventDispatcher::registeredTimers() function with this change.</li>
</ul>
<a name="changes-to-qdir"></a>
<h3 >Changes to QDir</h3>
<ul>
<li>The <code>convertSeparators()</code> function is removed. Use QDir::toNativeSeparators() instead.</li>
<li>The <code>QDir::NoDotAndDotDot</code> enum value is removed. Use QDir::NoDot or QDir::NoDotDot instead.</li>
</ul>
<a name="changes-to-qlocale"></a>
<h3 >Changes to QLocale</h3>
<ul>
<li>The QLocale data has been updated to CLDR 22.1&#x2e; The historical language and country names were updated to their modern values and some deprecated names were dropped or mapped to their modern alternatives.</li>
<li>The QLocale::toShort(), QLocale::toUShort(), QLocale::toInt(), QLocale::toUInt(), QLocale::toLongLong(), and QLocale::toULongLong() functions no longer take the argument for base. They localize base 10 conversions. To convert other bases, use the QString functions instead.</li>
</ul>
<a name="changes-to-qabstractitemmodel"></a>
<h3 >Changes to QAbstractItemModel</h3>
<ul>
<li>QAbstractItemModel::beginMoveRows() no longer emits the <code>layoutAboutToBeChanged</code> signal, and QAbstractItemModel::endMoveRows() no longer emits the <code>layoutChanged</code> signal. All proxy models must connect to (and disconnect from) the QAbstractItemModel::rowsAboutToBeMoved and QAbstractItemModel::rowsMoved signals.</li>
<li>QAbstractItemModel::sibling() is virtual now to allow implementations to optimize based on internal data.</li>
<li>QAbstractItemModel::createIndex() method now only provides the <code>void*</code> and <code>quintptr</code> overloads, making calls with a literal <code>0</code> (<code>createIndex(row, col, 0)</code>) ambiguous. Either cast <code>quintptr(0)</code> or omit the third argument to get the <code>void*</code> overload.</li>
<li>QAbstractItemModel::setRoleNames() is deprecated. Use QAbstractItemModel::roleNames() instead. 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>
</ul>
<a name="changes-to-qstring"></a>
<h3 >Changes to QString</h3>
<ul>
<li>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 QString and QByteArray. The size argument now has a default value of <code>-1</code>, replacing the separate constructors that did the same.</li>
<li>QString::mid(), QString::midRef(), and QByteArray::mid() now return an empty <code>QString</code>, <code>QStringRef</code>, and <code>QByteArray</code> 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 <code>QString</code> or a null <code>QStringRef</code>.</li>
<li>The following QString functions use the C locale instead of the default or system locale:<ul>
<li>toLongLong()</li>
<li>toULongLong()</li>
<li>toLong()</li>
<li>toULong()</li>
<li>toInt()</li>
<li>toUInt()</li>
<li>toShort()</li>
<li>toUShort()</li>
<li>toDouble()</li>
<li>toFloat()</li>
</ul>
<p>This is to guarantee consistent default conversion of strings. For locale-aware conversions use the equivalent QLocale functions.</p>
</li>
</ul>
<a name="changes-to-qdate-qtime-and-qdatetime"></a>
<h3 >Changes to QDate, QTime, and QDateTime</h3>
<ul>
<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>
<li>QDate::setYMD() is deprecated, use QDate::setDate() instead.</li>
<li>Adding days to a null QDate or seconds to a null QTime will no longer return a valid QDate/QTime.</li>
<li>The QDate::addDays() and QDateTime::addDays() functions now take a <code>qint64</code> argument, and the QDate::daysTo() and QDateTime::daysTo() functions now return a <code>qint64</code> value.</li>
<li>QDate and QTime are the <code>userProperty</code> for the QTimeEdit and QDateEdit classes, insted of QDateTime as it was for the 4.7 and 4.8 releases. The USER property for these classes was removed before Qt 4.7&#x2e;0 and added again in Qt 5.0&#x2e;</li>
<li>The serialization behavior for QDateTime is reverted to pre-Qt 5, because Qt::LocalTime is the local time (that is, <code>ymd hms</code>) regardless of the underlying system time, time zone, or changes in the system zone. Therefore, the consistent behavior when serialising is to save and restore as the local time and not its UTC equivalent. This means that the QDataStream version is 14 since Qt 5.1&#x2e;</li>
<li>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 as stored in a <code>qint64</code>, and as able to be used in QDateTime::setMSecsSinceEpoch() and QDateTime::toMSecsSinceEpoch().</li>
<li>QDate::fromString() and QDateTime::fromString() require non-numeric date component separators when parsing Qt::ISODate. A string like <i>2000901901</i> will no longer be recognized as a valid ISO date, whereas <i>2000/01/01</i> will, even though it differs from the ISO format <i>2000-01-01</i>.</li>
</ul>
<a name="changes-to-qtextcodec"></a>
<h3 >Changes to QTextCodec</h3>
<ul>
<li><code>QTextCodec::codecForCStrings()</code> and <code>QTextCodec::setCodecForCStrings()</code> are removed as they were creating uncertainty/bugs in using QString easily and (to a lesser extent) performance issues.</li>
<li><code>QTextCodec::codecForTr()</code> and <code>QTextCodec::setCodecForTr()</code> are removed.</li>
</ul>
<a name="changes-to-qurl"></a>
<h3 >Changes to QUrl</h3>
<p>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:</p>
<ul>
<li>QUrl::setPath() no longer handles relative paths. They are by definition invalid. Use the QUrl::NormalizePathSegments flag to remove /./ or /../ sequences as much as possible. It will not remove /../ from the beginning of the path.</li>
<li>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 <i>encoded</i> in the name are deprecated (except QUrl::toEncoded() and QUrl::fromEncoded()).<p>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 <i>%25</i> like QUrl::toEncoded() does.</p>
</li>
<li>QUrl no longer decodes %7B and %7D to &quot;{&quot; and &quot;}&quot; in the output of QUrl::toString().</li>
<li>QUrl now defaults to decoded mode in the getters and setters for <code>userName</code>, <code>password</code>, <code>host</code>, <code>topLevelDomain</code>, <code>path</code> and <code>fileName</code>. This means a % in one of those fields is now returned (or set) as <code>%</code> rather than <code>%25</code>. If the former behavior was expected, pass <code>PrettyDecoded</code> to the getter and <code>TolerantMode</code> to the setter.</li>
<li>QUrl no longer has functions that handle individual query items and query delimiters, such as <code>addQueryItem()</code> and <code>queryPairDelimiter()</code>. These have been moved to the new QUrlQuery class.</li>
<li>QUrl no longer considers all delimiter characters equivalent to their percent-encoded forms. QUrl and QUrlQuery always keep all delimiters exactly as they were in the original URL text.</li>
<li>QUrl no longer supports QUrl::FullyDecoded mode in QUrl::authority() and QUrl::userInfo(), nor QUrl::DecodedMode in QUrl::setAuthority() and QUrl::setUserInfo().</li>
<li>QUrl no longer decodes %23 found in the fragment to &quot;#&quot; in the output of QUrl::toString (<code>FullyEncoded</code>) or QUrl::toEncoded().</li>
</ul>
<a name="changes-to-qt-concurrent"></a>
<h2 id="changes-to-qt-concurrent">Changes to Qt Concurrent</h2>
<p>Qt Concurrent has been moved from Qt Core to its own module. To link against the Qt Core module, add this line to the project file:</p>
<pre class="cpp">

  QT <span class="operator">+</span><span class="operator">=</span> concurrent

</pre>
<p><b>Note: </b>The <code>QtConcurrent::Exception</code> class is renamed QException and <code>QtConcurrent::UnhandledException</code> class is renamed QUnhandledException. They remain in Qt Core.</p><a name="changes-to-qt-gui"></a>
<h2 id="changes-to-qt-gui">Changes to Qt GUI</h2>
<ul>
<li>QPen now has a default width of 1 instead of 0. Thus, it is no longer cosmetic by default.</li>
<li>QAccessibleActionInterface is now based on providing a list of action names. All functions have been changed to take arguments of type <code>string</code> insted of <code>int</code>.</li>
<li>The constructor of QAccessibleEvent does not need the <code>child</code> parameter anymore, and the corresponding <code>QAccessibleEvent::child()</code> function is removed.</li>
<li>The constructor of QTabletEvent does not need the <code>hiResGlobalPos</code> argument anymore, as all coordinates are floating point-based now.</li>
<li><code>QIconEngineV2</code> is now merged into QIconEngine. Update your sources to use <code>QIconEngine</code> instead of <code>QIconEngineV2</code>.</li>
<li>QSound is moved to Qt Multimedia from Qt GUI.</li>
<li><code>QDesktopServices::storageLocation()</code> and <code>QDesktopServices::displayName()</code> are replaced by QStandardPaths::writableLocation() and QStandardPaths::displayName() respectively. They are now in the Qt Core module. Make sure to read the QDesktopServices::storageLocation() documentation when porting from QDesktopServices::DataLocation.</li>
<li><code>QPixmap::grabWindow()</code> and <code>QPixmap::grabWidget()</code> are removed. Use QScreen::grabWindow() instead.</li>
<li>The session management API has been simplified. The <code>commitData()</code> function is removed and replaced by the signal QGuiApplication::commitDataRequest(). QApplication and QGuiApplication will emit this signal from 5.2 onward on supported platforms (Linux and Windows).</li>
<li><code>QWidget *widget()</code> is replaced with <code>QObject *target()</code> to avoid QWidget dependencies.</li>
</ul>
<a name="changes-to-qaccessibleinterface"></a>
<h3 >Changes to QAccessibleInterface</h3>
<ul>
<li>The <i>child</i> integer parameters are removed to bring QAccessibleInterface closer to IAccessible2. This means that the following functions lose the integer parameter:<ul>
<li><code>text(Text t, int child)</code> is now text(Text t)</li>
<li><code>rect(int child)</code> is now rect()</li>
<li><code>setText(Text t, int child, const QString &amp;text)</code> is now setText(Text t, const QString &amp;text)</li>
<li><code>role(int child)</code> is now role()</li>
<li><code>state(int child)</code> is now state()</li>
</ul>
</li>
<li><code>navigate()</code> is replaced with parent() and child() to navigate the hierarchy.</li>
<li><code>relationTo()</code> is replaced with relations().</li>
<li><code>QAccessibleInterface::userActionCount()</code>, <code>QAccessibleInterface::actionText()</code>, and <code>QAccessibleInterface::doAction()</code> are removed. We recommend using the QAccessibleInterface subclasses to implement the QAccessibleActionInterface instead.</li>
</ul>
<a name="changes-to-qimage"></a>
<h3 >Changes to QImage</h3>
<ul>
<li>QImage::fill() on an image with format <code>Format_RGB888</code> 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>
<li>The behavior of QImage::load(), QImage::loadFromData(), QPixmap::load(), and QPixmap::loadFromData() on a non-null image changed so that if the functions fail to load the image (return <code>false</code>), the the existent image data is invalidated, so that <code>isNull()</code> is guaranteed to return <code>true</code> in this case.</li>
</ul>
<a name="changes-to-qpainter"></a>
<h3 >Changes to QPainter</h3>
<ul>
<li>QPainter does not support uniting clipped regions anymore. Use QRegion::united() instead to unite clips and pass the result to QPainter.</li>
<li>QPainter fill rules when not using antialiased painting have changed so that the aliased and antialiased coordinate systems match. There used to be an offset of slightly less than half a pixel when doing sub-pixel rendering, in order to be consistent with the old X11 paint 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 old behavior, set the QPainter::Qt4CompatiblePainting render hint.</li>
</ul>
<a name="changes-to-qtouchevent"></a>
<h3 >Changes to QTouchEvent</h3>
<ul>
<li>QTouchEvent::DeviceType and QTouchEvent::deviceType() are deprecated as QTouchDevice provides a better way to identify and access the device from which the events originate.</li>
<li>The constructor now takes a QTouchDevice pointer instead of <code>DeviceType</code> value.</li>
<li><code>TouchPointStateMask</code> and <code>TouchPointPrimary</code> are removed from the Qt::TouchPointStates enum.</li>
<li><code>QTouchEvent::TouchPoint::isPrimary()</code> is removed.</li>
</ul>
<a name="changes-to-qt-widgets"></a>
<h2 id="changes-to-qt-widgets">Changes to Qt Widgets</h2>
<ul>
<li>QItemEditorFactory::createEditor() and QItemEditorFactory::valuePropertyName() signatures are changed to take arguments of type <code>int</code> instead of QVariant::Type.</li>
<li><code>QInputContext</code> is removed as related getter and setter functions in QWidget and QApplication are removed. Input contexts are now platform-specific.</li>
<li>QInputDialog::getInteger() is deprecated. Use QInputDialog::getInt() instead.</li>
<li>The <code>QStyleOption*V{2,3,4}</code> classes are removed, and their members are merged with the respective base classes. The removed classes are left as typedefs for binary compatibility.</li>
<li>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.</li>
<li><code>QProxyModel</code> is removed. Use QAbstractProxyModel and the related classes instead. A copy of <code>QProxyModel</code> is available in the <a href="http://wiki.qt.io/Qt_5_UI_Helpers">Ui Helpers</a> repository.</li>
</ul>
<a name="changes-to-qapplication"></a>
<h3 >Changes to QApplication</h3>
<ul>
<li><code>QApplication::setGraphicsSystem()</code> is removed, because the introduction of <a href="qpa.html">QPA</a> made it redundant.</li>
<li><code>QApplication::commitData</code> and <code>QApplication::saveState</code> virtual methods that were used for session management are removed. Connect to the QApplication::commitDataRequest and QApplication::saveStateRequest signals instead. Use QApplication::isSavingSession() if the QWidget::closeEvent if your window needs to know whether it is being called during shutdown.</li>
</ul>
<a name="changes-to-qstyle"></a>
<h3 >Changes to QStyle</h3>
<ul>
<li><code>QStyle::standardIconImplementation()</code> and <code>QStyle::layoutSpacingImplementation()</code> are removed, and the QStyle::standardIcon() and QStyle::layoutSpacing() functions are made pure virtual now. The removed functions were introduced in Qt 4 for binary compatibility reasons.</li>
<li><code>QMotifStyle</code>, <code>QPlastiqueStyle</code>, <code>QCleanlooksStyle</code>, and <code>QCDEStyle</code> are replaced with a new <i>fusion</i> style. If your application depends on any of these removed styles, you can either use the <a href="http://code.qt.io/cgit/qt/qtstyleplugins.git/">qtstyleplugins</a> project to get these styles or update your application to use the new fusion style. For more details about this change, see <a href="https://blog.qt.io/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/">https://blog.qt.io/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/</a>.</li>
<li>The following QStyle implementations have been made internal:<ul>
<li>QFusionStyle</li>
<li>QGtkStyle</li>
<li>QMacStyle</li>
<li>QWindowsCEStyle</li>
<li>QWindowsMobileStyle</li>
<li>QWindowsStyle</li>
<li>QWindowsVistaStyle</li>
<li>QWindowsXPStyle</li>
</ul>
<p>Instead of creating instances or inheriting these classes directly, use:</p>
<ul>
<li>QStyleFactory for creating instances of specific styles.</li>
<li>QProxyStyle for customizing existing style implementations.</li>
<li>QCommonStyle as a base for implementing full custom styles.</li>
</ul>
</li>
</ul>
<a name="changes-to-qheaderview"></a>
<h3 >Changes to QHeaderView</h3>
<p>The following functions are deprecated:</p>
<ul>
<li><code>void setMovable(bool movable)</code> - Use QHeaderView::setSectionsMovable() instead.</li>
<li><code>bool isMovable() const</code> - Use QHeaderView::sectionsMovable() instead.</li>
<li><code>void setClickable(bool clickable)</code> - Use QHeaderView::setSectionsClickable() instead.</li>
<li><code>bool isClickable() const</code> - Use QHeaderView::sectionsClickable() instead.</li>
<li><code>void setResizeMode(int logicalindex, ResizeMode mode)</code> - Use QHeaderView::setSectionResizeMode() instead.</li>
<li><code>ResizeMode resizeMode(int logicalindex) const</code> - Use QHeaderView::sectionResizeMode() instead.</li>
</ul>
<a name="changes-to-qabstractitemview"></a>
<h3 >Changes to QAbstractItemView</h3>
<ul>
<li>The derived classes now emit the <code>clicked()</code> signal on the left mouse click only, instead of all mouse clicks.</li>
<li>The virtual QAbstractItemView::dataChanged() function signature now includes the roles that have changed. The signature is consistent with the <code>dataChanged()</code> signal in the model.</li>
</ul>
<a name="changes-to-qcolordialog"></a>
<h3 >Changes to QColorDialog</h3>
<ul>
<li>QColorDialog::customColor() now returns a QColor value instead of <code>QRgb</code>.</li>
<li>QColorDialog::setCustomColor() and QColorDialog::setStandardColor() now need a QColor value as their second parameter instead of <code>QRgb</code>.</li>
</ul>
<a name="changes-to-qt-webkit"></a>
<h2 id="changes-to-qt-webkit">Changes to Qt WebKit</h2>
<ul>
<li>The WebKit module in Qt is now split in two modules, <code>webkit</code> and <code>webkitwidgets</code>, in order to allow the dependency of the <code>widgets</code> module to be optional. The benefits will only be available once the QQuickWebView API is made public through C++ in a future version. The <code>webkitwidgets</code> module adds the <code>webkit</code> module automatically to the project, so in your application's project file, <code>QT += webkit</code> should now be modified to:<pre class="cpp">

  QT <span class="operator">+</span><span class="operator">=</span> webkitwidgets

</pre>
</li>
<li>The same applies to the module include, <code>#include &lt;QtWebKit/QtWebKit&gt;</code> should be modified to:<pre class="cpp">

  <span class="preprocessor">#include &lt;QtWebKitWidgets/QtWebKitWidgets&gt;</span>

</pre>
</li>
<li>A consequence of the module split is that classes of the <a href="http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html">Qt WebKit</a> API aren't all in the new module, so for a better compatibility of your application with both Qt4 and Qt5, #include &lt;QtWebKit/QWebPage&gt;, for example, should be included directly as:<pre class="cpp">

  <span class="preprocessor">#include &lt;QWebPage&gt;</span>

</pre>
<p>The include path will take care of selecting the right module.</p>
</li>
<li>The qwebkitversion.h header has been renamed to q<b>t</b>webkitversion.h to match other Qt modules, and part of its contents has been moved to qwebkitglobal.h&#x2e; <code>#include &lt;qwebkitversion.h&gt;</code> should be replaced with two includes:<pre class="cpp">

  <span class="preprocessor">#include &lt;qtwebkitversion.h&gt;</span>
  <span class="preprocessor">#include &lt;qwebkitglobal.h&gt;</span>

</pre>
</li>
</ul>
<a name="changes-to-qt-print-support"></a>
<h2 id="changes-to-qt-print-support">Changes to Qt Print Support</h2>
<ul>
<li>The <code>QPageSetupDialog::PageSetupDialogOption</code> enum and the corresponding set and get functions, <code>QPageSetupDialog::options()</code> and <code>QPageSetupDialog::setOptions()</code> are removed.</li>
<li>Support for printing PostScript files has been removed.</li>
<li>The <code>QAbstractPageSetupDialog</code> class is removed. Use QPrintDialog instead.</li>
<li>The QPrintEngine::PrintEnginePropertyKey enum value <code>PPK_SuppressSystemPrintStatus</code> is removed.</li>
<li>QPrinter no longer allows you to set an invalid printer name.</li>
</ul>
<a name="changes-to-qt-network"></a>
<h2 id="changes-to-qt-network">Changes to Qt Network</h2>
<ul>
<li>The <code>QSsl::TlsV1</code> enum value is renamed as QSsl::TlsV1_0.</li>
<li>The <code>QHttp</code>, <code>QHttpHeader</code>, <code>QHttpResponseHeader</code>, and <code>QHttpRequestHeader</code> classes are removed. Use QNetworkAccessManager instead.</li>
<li>The <code>QFtp</code> and <code>QUrlInfo</code> classes are no longer exported. Use QNetworkAccessManager instead. Programs that require raw FTP or HTTP streams can use the <a href="https://codereview.qt-project.org/#/admin/projects/qt/qtftp">Qt FTP</a> and <a href="https://codereview.qt-project.org/#/admin/projects/qt/qthttp">Qt HTTP</a> compatibility add-on modules that provide the <code>QFtp</code> and <code>QHttp</code> classes as they existed in Qt 4.</li>
<li>QAbstractSocket::connectToHost() and QAbstractSocket::disconnectFromHost() are virtual now, and <code>QAbstractSocket::connectToHostImplementation()</code> and <code>QAbstractSocket::disconnectFromHostImplementation()</code> are removed.</li>
<li>QTcpServer::incomingConnection() now takes arguments of type <code>qintptr</code> instead of an <code>int</code>.</li>
<li><code>QNetworkConfiguration::bearerName()</code> is removed. Use the bearerTypeName() instead.</li>
</ul>
<a name="changes-to-qsslcertificate"></a>
<h3 >Changes to QSslCertificate</h3>
<ul>
<li>QSslCertificate::subjectInfo() and QSslCertificate::issuerInfo() now return QStringList instead of a QString. This change makes searching the required information a lot easier than scanning a long string.</li>
<li>QSslCertificate::isValid() is deprecated. Use QSslCertificate::isBlacklisted() instead to avoid binary breaks in the future.</li>
<li>QSslCertificate::alternateSubjectNames() is deprecated. Use QSslCertificate::subjectAlternativeNames() instead.</li>
</ul>
<a name="changes-to-qt-sql"></a>
<h2 id="changes-to-qt-sql">Changes to Qt SQL</h2>
<ul>
<li>QSqlQueryModel::indexInQuery() is virtual now.</li>
<li>QSqlQueryModel::setQuery() emits fewer signals. The <code>modelAboutToBeReset()</code> and <code>modelReset()</code> signals are sufficient to inform views that they must re-interrogate the model.</li>
<li>QSqlDriver::subscribeToNotification(), QSqlDriver::unsubscribeFromNotification(), QSqlDriver::subscribedToNotifications(), QSqlDriver::isIdentifierEscaped(), and QSqlDriver::stripDelimiters() are virtual now. The corresponding <code>xxxImplementation</code> functions are also removed as the subclasses of QSqlDriver can re-implement those directly.</li>
<li>QSqlError now handles alphanumeric error codes that are used by QPSQL. The numeric codes are deprecated.</li>
</ul>
<a name="changes-to-qt-test"></a>
<h2 id="changes-to-qt-test">Changes to Qt Test</h2>
<ul>
<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>
<li>The <code>QTRY_VERIFY</code> and <code>QTRY_COMPARE</code> macros are now part of <code>QTestLib</code>. These macros were part of <code>tests/shared/util.h</code> earlier, but now they are part of the &lt;QtTest/QtTest&gt; header. In addition, <code>QTRY_VERIFY_WITH_TIMEOUT</code> and <code>QTRY_COMPARE_WITH_TIMEOUT</code> are provided to specify custom timeout values.</li>
<li>The <code>QTEST_NOOP_MAIN</code> 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 <code>QSKIP</code> in the <code>initTestCase()</code> method to skip the entire test. If you're using the later approach, report a meaningful explanation in the test log.</li>
<li>The <code>DEPENDS_ON</code> 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>
<li><code>QTest::qt_snprintf()</code> 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().</li>
<li>c{QTest::pixmapsAreEqual()} is removed. Comparison of QPixmap objects must be done using the <code>QCOMPARE</code> macro, which provides more informative output in the event of a failure.</li>
<li>The <code>&quot;mode&quot;</code> parameter in <code>QSKIP</code> macro is removed. This parameter caused problems in test metrics calculation because of the <code>SkipAll</code> mode, which hid information about the skipped test data. Calling <code>QSKIP</code> in a test function now behaves like <code>SkipSingle</code>, 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>
<li><code>qCompare()</code> has been replaced by overloading. Code such as <code>qCompare&lt;QString&gt;(l, r)</code> no longer uses the QString-specific implementation and may fail to compile. We recommend that you replace specialization with overloading. Also, rather than pass explicit template arguments to <code>qCompare</code>, let the overload resolution pick the correct one, and cast arguments in case of ambiguous overloads (for example, <code>qCompare(QString(l), r)</code>). The resulting code will continue to work against older QtTestlib versions.</li>
<li><code>QTest::qWaitForWindowShown()</code> is replaced with QTest::qWaitForWindowExposed().</li>
</ul>
<a name="changes-to-qt-opengl"></a>
<h2 id="changes-to-qt-opengl">Changes to Qt OpenGL</h2>
<p>Apart from the QGLWidget class, the Qt OpenGL module should not be used for new code. Instead, use the corresponding <i>OpenGL</i> classes in Qt GUI.</p>
<ul>
<li>QGLPixelBuffer is deprecated and implemented by using a hidden QGLWidget and a QOpenGLFramebufferObject. For offscreen rendering to a texture, switch to using QOpenGLFramebufferObject directly to improve performance.</li>
<li>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 using QGLFormat::setVersion().</li>
<li><code>QGLContext::generateFontDisplayLists()</code> and <code>QGLWidget::fontDisplayListBase()</code> are removed.</li>
<li>The <code>listBase</code> parameter is removed from QGLWidget::renderText() functions.</li>
<li>To ensure support on more platforms, stricter requirements have been introduced for doing threaded <code>OpenGL</code>. First, you must call QGLWidget::makeCurrent() at least once per each QGLWidget::swapBuffers() call, so that the platform has a chance to synchronize resizing the <code>OpenGL</code> surface. Second, before calling QGLWidget::makeCurrent() or QGLWidget::swapBuffers() in a separate thread, you must call QGLContext::moveToThread() to explicitly let Qt know in which thread a QGLContext is currently being used. You also need to make sure that the context is not current in the current thread before moving it to a different thread.</li>
</ul>
<a name="changes-to-qt-global"></a>
<h2 id="changes-to-qt-global">Changes to Qt Global</h2>
<ul>
<li><code>qMacVersion()</code> is removed. Use QSysInfo::macVersion() or QSysInfo::MacintoshVersion instead.</li>
<li><code>Qt::escape()</code> is deprecated. Use QString::toHtmlEscaped() instead.</li>
<li><code>qIsDetached&lt;&gt;</code> is removed, becauses it is irrelevant for multi-threaded applications. There is no replacement for this function.</li>
</ul>
<a name="changes-to-tools"></a>
<h2 id="changes-to-tools">Changes to Tools</h2>
<ul>
<li>The <code>qttest_p4.prf</code> file is removed. Use <code>CONFIG+=testcase</code> and other flags instead.</li>
<li>The <code>-dwarf2</code> configure argument is removed. DWARF2 is always used on macOS now.</li>
<li>Configure no longer calls <code>qmake -recursive</code> by default, because the subsequent build invokes qmake as needed. Use <code>-fully-process</code> to restore the old behavior.</li>
<li>The lupdate <code>CODECFORTR</code> variable is deprecated, because source code written with Qt 5 is expected to use UTF-8 encoding.</li>
</ul>
<a name="related-topics"></a>
<h2 id="related-topics">Related Topics</h2>
<ul>
<li><a href="newclasses55.html">New Classes and Functions in Qt 5.5</a></li>
<li><a href="newclasses54.html">New Classes and Functions in Qt 5.4</a></li>
<li><a href="newclasses53.html">New Classes and Functions in Qt 5.3</a></li>
<li><a href="newclasses52.html">New Classes and Functions in Qt 5.2</a></li>
<li><a href="newclasses51.html">New Classes and Functions in Qt 5.1</a></li>
</ul>
</div>
<!-- @@@sourcebreaks.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    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. </p>
</div>
</body>
</html>