Some of the changes listed in this file include issue tracking numbers corresponding to tasks in the Qt Bug Tracker: http://bugreports.qt-project.org/ Each of these identifiers can be entered in the bug tracker to obtain more information about a particular change. **************************************************************************** * Source incompatible changes * **************************************************************************** - The Qt 3 support module and all related code was removed. - QAtomicInt's and QAtomicPointer's non-atomic convenience methods (i.e., operator=, operator int / operator T*, operator!, operator==, operator!= and operator->) have been removed as they did implicit loads and stores of unspecified memory ordering. Code dealing with is expected to use load(), loadAquire(), store() and storeRelease() as necessary instead. - QObject * The signatures of the connectNotify() and disconnectNotify() functions have changed. The functions now get passed a QMetaMethod that identifies the signal, rather than a const char *. - QSslCertificate::subjectInfo() and QSslCertificate::issuerInfo() now return a QStringList instead of a QString - QSslCertificate::isValid() has been deprecated. Originally it only checked the certificate dates, but later checking for blacklisting was added. Now there's a more specific QSslCertificate::isBlacklisted() method. - Unite clipping support has been removed from QPainter. The alternative is to unite QRegion's and using the result on QPainter. - QLibrary::resolve() now returns a function pointer instead of a void pointer. - QSslCertificate::alternateSubjectNames() is deprecated (but can be enabled via QT_DISABLE_DEPRECATED_BEFORE), use QSslCertificate::subjectAlternativeNames() instead. - QLibraryInfo::buildKey() has been removed. Likewise, the QT_BUILD_KEY preprocessor #define has also been removed. The build-key is obsolete and is no longer necessary. - QCoreApplication::translate() will no longer return the source text when the translation is empty. Use lrelease -removeidentical for optimization. - QTranslator subclasses need to adjust the signature of the virtual method translate() in order to add the "int n = -1" argument. - QString and QByteArray constructors that take a size argument will now treat negative sizes to indicate nul-terminated strings (a nul-terminated array of QChar, in the case of QString). In Qt 4, negative sizes were ignored and result in empty QString and QByteArray, respectively. The size argument to those constructors now has a default value of -1, thus replacing the separate constructors that did the same. - Qt::escape() is deprecated (but can be enabled via QT_DISABLE_DEPRECATED_BEFORE), use QString::toHtmlEscaped() instead. - QBool is gone. QString::contains, QByteArray::contains, and QList::contains used to return an internal QBool class so that the Qt3 code "if (a.contains() == 2)" wouldn't compile anymore. Such code cannot exist in Qt4, so these methods return a bool now. If your code used the undocumented QBool, simply replace it with bool. - The old macros TRUE and FALSE have been removed, use true and false instead. - qIsDetached<> has been removed without replacement. - The return type of QFlags::operator int() now matches the Enum's underlying type in signedness instead of always being 'int'. This was done in order to allow QFlags over enums whose underlying type is unsigned (Qt::MouseButton is one such enum). - QMetaType: * QMetaType::construct() has been renamed to QMetaType::create(). * QMetaType::unregisterType() has been removed. * QMetaType now records if the type argument inherits QObject. This can be used in scripting APIs, so that custom QObject subclasses are treated as QObject pointers. In QtScript for example, this can mean that QScriptValue.isQObject can be true where it was false before. * QMetaType::QWidgetStar has been removed. Use qMetaTypeId() or QVariant::canConvert() as appropriate. - QMetaMethod: * QMetaMethod::signature() has been renamed to QMetaMethod::methodSignature(), and the return type has been changed to QByteArray. This was done to be able to generate the signature string on demand, rather than always storing it in the meta-data. * QMetaMethod::typeName() no longer returns an empty string when the return type is void; it returns "void". The recommended way of checking whether a method returns void is to compare the return value of QMetaMethod::returnType() to QMetaType::Void. - QVariant: * Inconsistent constructor taking Qt::GlobalColor and producing QVariant(QColor) instance was removed. Code constructing such variants can be migrated by explicitly calling QColor constructor. For example from "QVariant(Qt::red)" to "QVariant(QColor(Qt::red))" * Similarly, implicit creation of QVariants from enum values Qt::BrushStyle, Qt::PenStyle, and Qt::CursorShape have been removed. Create objects explicitly or use static_cast(Qt::SolidLine) to create a QVariant of type int with the same value as the enum. - QLocale: * The historical language and country names were updated to their modern values, some deprecated names were dropped or mapped to their modern alternatives. - QTestLib: * The plain-text, xml and lightxml test output formats have been changed to show a test result for every row of test data in data-driven tests. In Qt4, only fails and skips were shown for individual data rows and passes were not shown for individual data rows, preventing accurate calculation of test run rates and pass rates. * The QTRY_VERIFY and QTRY_COMPARE macros have been moved into QTestLib. These macros formerly lived in tests/shared/util.h but are now provided by including the header. In addition, QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT are provided, allowing for specifying custom timeout values. * The QTEST_NOOP_MAIN macro has been removed from the API. If a test is known at compile-time to be inapplicable for a particular build it should be omitted via .pro file logic, or the test should call QSKIP in the initTestCase() method to skip the entire test and report a meaningful explanation in the test log. * The DEPENDS_ON macro has been removed from the API. This macro did nothing and misled some users to believe that they could make test functions depend on each other or impose an execution order on test functions. * The QTest::qt_snprintf function has been removed from the API. This was an internal testlib function that was exposed in the public API due to its use in a public macro. Any calls to this function should be replaced by a call to qsnprintf(), which comes from the header. * The QTest::pixmapsAreEqual() function has been removed from the API. Comparison of QPixmap objects should be done using QCOMPARE, which provides more informative output in the event of a failure. * The QSKIP macro no longer has the "mode" parameter, which caused problems for calculating test metrics, as the SkipAll mode hid information about what test data was skipped. Calling QSKIP in a test function now behaves like SkipSingle -- 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. * The qCompare() function template was both overloaded and specialised, which made it almost impossible to specialise the correct primary template and could lead to indecipherable error messages or surprising overload resolution (such as going via qCompare(QFlags,int) to satisfy a request for qCompare()). Now, specialisation has been replaced by overloading. As a consquence, code such as qCompare(l, r) will no longer use the QString-specific implementation and may fail to compile. We recommend you replace specialisations with overloading, too. Also, don't pass explicit template arguments to qCompare (e.g. qCompare(l, r)), but let overload resolution pick the correct one, and cast arguments in case of ambiguous overloads (e.g. qCompare(QString(l), r)). The resulting code will continue to work against older QtTestlib versions. - The QSsl::TlsV1 enum value was renamed to QSsl::TlsV1_0 . - QAccessible: * Internal QAccessible::State enum value HasInvokeExtension removed - QAccessibleInterface: * The "child" integer parameters have been removed. This moves the api to be closer to IAccessible2. This means several functions lose their integer parameter: text(Text t, int child) -> text(Text t), rect(int child) -> rect() setText(Text t, int child, const QString &text) -> setText(Text t, const QString &text) role(int child) -> role(), state(int child) -> state() * parent() and child() was added in order to do hierarchical navigation. * relations() was added as a replacement to relationTo() * As a consequence of the above two points, navigate() was removed. * Accessible-Action related functions have been removed. QAccessibleInterface subclasses are expected to implement the QAccessibleActionInterface instead. These functions have been removed: QAccessibleInterface::userActionCount, QAccessibleInterface::actionText, QAccessibleInterface::doAction - QAccessibleEvent also loses the child parameter. QAccessibleEvent(Type type, int child) -> QAccessibleEvent(Type type) QAccessibleEvent::child() removed. - QAccessibleActionInterface: * Refactored to be based on action names. All functions have been changed from using int parameters to strings. - QSound has been moved from QtGui to QtMultimedia - QTabletEvent::QTabletEvent does not take a hiResGlobalPos argument anymore, as all coordinates are floating point based now. - QTouchEvent: * The DeviceType enum and deviceType() have been deprecated due to the introduction of QTouchDevice. * The signature of the constructor has changed. It now takes a QTouchDevice pointer instead of just a DeviceType value. * TouchPointState no longer includes TouchPointStateMask and TouchPointPrimary. QTouchEvent::TouchPoint::isPrimary() has been removed. * QWidget *widget() has been removed and is replaced by QObject *target() in order to avoid QWidget dependencies. * QEvent::TouchCancel has been introduced. On systems where it makes sense this event type can be used to differentiate between a regular TouchEnd and abrupt touch sequence cancellations caused by the compositor, for example when a system gesture gets recognized. - QMetaType * Q_DECLARE_METATYPE(Foo*) now requires that Foo is fully defined. In cases where a forward declared type should be used as a metatype, Q_DECLARE_OPAQUE_POINTER(Foo*) can be used to allow that. * Similarly, Q_DECLARE_METATYPE(QSharedPointer), and Q_DECLARE_METATYPE(QWeakPointer) require Foo to be fully defined. Again though, Q_DECLARE_OPAQUE_POINTER(Foo*) can be used to allow that. - QItemEditorFactory * The signature of the createEditor and valuePropertyName methods have been changed to take arguments of type int instead of QVariant::Type. - QModelIndex/QAbstractItemModel * The integer value that can be stored in a QModelIndex is now of type quintptr to match the size of the internal storage location. * The createIndex() method now only provides the void* and quintptr overloads, making calls with a literal 0 (createIndex(row, col, 0)) ambiguous. Either cast (quintptr(0)) or omit the third argument (to get the void* overload). - QWindowSystemInterface: * The signature of all handleTouchEvent() variants have changed, taking a QTouchDevice* instead of just a DeviceType value. Platform or generic plug-ins have to create and register at least one QTouchDevice before sending the first touch event. * The event type parameter is removed from handleTouchEvent(). - The previously exported function qt_translateRawTouchEvent() has been removed. Use QWindowSystemInterface::handleTouchEvent() instead. - QAbstractEventDispatcher * The signature for the pure-virtual registerTimer() has changed. Subclasses of QAbstractEventDispatcher will need to be updated to reimplement the new pure-virtual 'virtual void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) = 0;' * QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a struct with 3 members: struct TimerInfo { int timerId; int interval; Qt::TimerType timerType; }; Reimplementations of QAbstractEventDispatcher::registeredTimers() will need to be updated to pass 3 arguments to the TimerInfo constructor (instead of 2). - QUuid * Removed implicit conversion operator QUuid::operator QString(), instead QUuid::toString() function should be used. - The QHttp, QHttpHeader, QHttpResponseHeader and QHttpRequestHeader classes have been removed, QNetworkAccessManager should be used instead. - The QFtp and QUrlInfo classes are no longer exported, QNetworkAccessManager should be used instead. These classes are available in a separate module, qtftp. - QProcess * On Windows, QProcess::ForwardedChannels will not forward the output of GUI applications anymore, if they do not create a console. - QAbstractSocket's connectToHost() and disconnectFromHost() are now virtual and connectToHostImplementation() and disconnectFromHostImplementation() don't exist. - QTcpServer::incomingConnection() now takes a qintptr instead of an int. - QNetworkConfiguration::bearerName() removed, and bearerTypeName() should be used. - QDir::convertSeparators() (deprecated since Qt 4.2) has been removed. Use QDir::toNativeSeparators() instead. - QIconEngineV2 was merged into QIconEngine You might need to adjust your code if it used a QIconEngine. - QTextCodecPlugin has been removed since it is no longer used. All text codecs are now built into QtCore. - QDir::NoDotAndDotDot is QDir::NoDot|QDir::NoDotDot therefore there is no need to use or check both. - QFSFileEngine, QAbstractFileEngine, QAbstractFileEngineIterator and QAbstractFileEngineHandler were removed from public API and are no longer exported. They may temporarily live as private implementation details, but they may be altogether dropped or otherwise changed at will in the future. - QLocale * toShort(), toUShort(), toInt(), toUInt(), toLongLong() and toULongLong() no longer take a parameter for base, they will only perform localised base 10 conversions. For converting other bases use the QString methods instead. - QSystemLocale has been removed from the public API. - QSqlQueryModel::indexInQuery() is now virtual. See note below under QtSql. - QSqlDriver::subscribeToNotification, unsubscribeFromNotification, subscribedToNotifications, isIdentifierEscaped, and stripDelimiters are now virtual. See note below under QtSql. - qMacVersion() has been removed. Use QSysInfo::macVersion() or QSysInfo::MacintoshVersion instead. - QColorDialog::customColor() now returns a QColor value instead of QRgb. QColorDialog::setCustomColor() and QColorDialog::setStandardColor() now take a QColor value for their second parameter instead of QRgb. - QPageSetupDialog has had the PageSetupDialogOption enum and the api to set and get the enum removed as none of the Options are used any more. - QAbstractPageSetupDialog has been removed. - QThread::terminated() has been removed, since its emission cannot be guaranteed. - QPrintEngine - Removed the PPK_SuppressSystemPrintStatus key as no longer used. - QCoreApplication::Type and QApplication::type() have been removed. These Qt3 legacy application types did not match the application types available in Qt5. Use for example qobject_cast instead to dynamically find out the exact application type. - The following QStyle implementations have been made internal: * QFusionStyle * QGtkStyle * QMacStyle * QWindowsCEStyle * QWindowsMobileStyle * QWindowsStyle * 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. **************************************************************************** * General * **************************************************************************** General Improvements -------------------- - The directory structure of the qtbase unit-tests has been reworked to more closely match the directory structure of the code under test. Integration tests have been moved to tests/auto/integrationtests. - Qt is compiled with C++11 support enabled by default, provided the compiler supports C++11. Qmake based projects can enable C++11 support explicitly using 'CONFIG+=c++11' in their .pro files. To enable it conditionally, use 'contains(QT_CONFIG,c++11):CONFIG+=c++11'. This will enable C++11 support only if Qt was built with C++11 support. - The Unicode Data and Algorithms has been updated to match the Unicode Standard of version 6.2. For more information see http://www.unicode.org/ - The QLocale data has been updated to CLDR 22.1. For more information see http://cldr.unicode.org/ Third party components ---------------------- - SQLITE_ENABLE_FTS3,SQLITE_ENABLE_FTS3_PARENTHESIS and SQLITE_ENABLE_RTREE flags are now enabled by default on all platforms, for the sqlite3 copy under the 3rdparty directory. Legal ----- - Copyright of Qt has been transferred to Digia Plc. **************************************************************************** * Library * **************************************************************************** QtCore ------ * [QTBUG-12144], [QTBUG-18360] The QChar methods are now able to handle the full range of Unicode codepoints defined by the Unicode Standard of version 6.2. QChar::isPrint() will no longer return a false positives for the Unicode format characters, surrogates, and private use characters. * Drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned value is returned for an unassigned codepoints now. * layoutAboutToBeChanged is no longer emitted by QAbstractItemModel::beginMoveRows. layoutChanged is no longer emitted by QAbstractItemModel::endMoveRows. Proxy models should now also connect to (and disconnect from) the rowsAboutToBeMoved and rowsMoved signals. * The QAbstractItemModel::sibling method was made virtual, allowing implementations to optimize based on internal data. * The default value of the property QSortFilterProxyModel::dynamicSortFilter was changed from false to true. * The signature of the virtual QAbstractItemView::dataChanged method has changed to include the roles which have changed. The signature is consistent with the dataChanged signal in the model. * QFileSystemWatcher is now able to return failure in case of errors whilst altering the watchlist in both the singular and QStringList overloads of addPath and removePath. * QString::mid, QString::midRef and QByteArray::mid, if the position passed is equal to the length (that is, right after the last character/byte), now return an empty QString, QStringRef or QByteArray respectively. in Qt 4 they returned a null QString or a null QStringRef. * QString methods toLongLong(), toULongLong(), toLong(), toULong(), toInt(), toUInt(), toShort(), toUShort(), toDouble(), and toFloat() no longer use the default or system locale, they will always use the C locale. This is to guarantee consistent default conversion of strings. For locale-aware conversions use the equivalent QLocale methods. * QDate, QTime, and QDateTime have undergone important behavioural changes: * QDate only implements the Gregorian calendar, the switch to the Julian calendar before 1582 has been removed. This means all QDate methods will return different results for dates prior to 15 October 1582, and there is no longer a gap between 4 October 1582 and 15 October 1582. * QDate::setYMD() is deprecated, use QDate::setDate() instead * Most methods now apply strict validity checks and will return appropriate and consistent values when invalid. For example, QDate::year() will return 0 and QDate::shortMonthName() will return QString(). * Adding days to a null QDate or seconds to a null QTime will no longer return a valid QDate/QTime. * QDate stores the Julian Day as a qint64 extending date support across a more interesting range, see the class documentation for details. * Conversion to YMD form dates is only accurate between to 4800 BCE to 1.4 million CE * The QDate::addDays() and QDateTime::addDays() methods now take a qint64 * The QDate::daysTo() and QDateTime::daysTo() methods now return a qint64 * QTextCodec::codecForCStrings() and QTextCodec::setCodecForCStrings() have both been removed. This was removed due to issues with breaking other code from libraries, creating uncertainty/bugs in using QString easily, and (to a lesser extent) performance issues. * QTextCodec::codecForTr() and QTextCodec::setCodecForTr() have been removed. QObject::trUtf8 and QCoreApplication::Encoding enum are now obsolete. Qt assumes that the source code is encoded in UTF-8. * QFile::setEncodingFunction and QFile::setDecodingFunction are obsolete and do nothing in Qt 5. The QFile::encodeName and QFile::decodeName functions are now hardcoded to operate on QString::fromLocal8Bit and QString::toLocal8Bit only. Therefore, it's still possible to obtain the old behaviour by calling QTextCodec::setCodecForLocale. However, that is not recommended: new code should not make assumptions about the filesystem encoding and older code should have those assumptions removed. * QIntValidator and QDoubleValidator no longer fall back to using the C locale if the requested locale fails to validate the input. * A new set of classes for doing pattern matching with Perl-compatible regular expressions has been added: QRegularExpression, QRegularExpressionMatch and QRegularExpressionMatchIterator. They aim to replace QRegExp with a more powerful and flexible regular expression engine. * QEvent::AccessibilityPrepare, AccessibilityHelp and AccessibilityDescription removed: * The enum values simply didn't make sense in the first place and should simply be dropped. * Filtering of native events (QCoreApplication::setEventFilter, as well as QApplication::x11EventFilter/macEventFilter/qwsEventFilter/winEventFilter) have been replaced with QCoreApplication::installNativeEventFilter and removeNativeEventFilter, for an API much closer to QEvent filtering. Note that the native events that can be filtered this way depend on which QPA backend is chosen, at runtime. On X11, XEvents are not used anymore, and have been replaced with xcb_generic_event_t due to the switch to XCB, which requires porting the application code to XCB as well. * [QTBUG-23529] QHash is now more resilient to a family of denial of service attacks exploiting algorithmic complexity, by supporting two-arguments overloads of the qHash() hashing function. * [QTBUG-4844] QObject::disconnectNotify() is now called when a receiver is destroyed. * QStateMachine - [QTBUG-15430] Added a QStateMachine constructor that takes a ChildMode parameter. - [QTBUG-17975] Delayed event posting now works from secondary threads. - [QTBUG-19789] Signal transitions now work correctly when the sender is in a different thread. - [QTBUG-20362] Property assignments now work as expected with nested, parallel states. - [QTBUG-22931] The root state can now be a parallel state group. - [QTBUG-24307] The initial state is now entered before the started() signal is emitted. - [QTBUG-25959] State entry and exit order is now SCXML spec-compliant. * qDebug(), qWarning(), qCritical(), and qFatal() were changed to macros that track the origin of the message in source code. Whether this and other meta-information is printed can be configured (for the default message handler) by setting the new QT_MESSAGE_PATTERN environment variable. qInstallMsgHandler() has been deprecated, and should be replaced with qInstallMessageHandler(). * QTextBoundaryFinder - [QTBUG-6498] The word start and word end boundaries detection is now unaware of surrounding white space characters. - SoftHyphen enum value has been added to specify a line break opportunity at a soft hyphen (SHY) character. - MandatoryBreak enum value has been added to specify a mandatory (aka "hard") line breaks. - Source-incompatible change: Since the behavior of boundaryReasons() method has been changed a lot, StartWord/EndWord enum values were intentionally replaced with StartOfItem/EndOfItem ones to force the affected code be revised. * Softkeys API was removed. The following functions and enums were removed: - QAction::setSoftKeyRole() - QAction::softKeyRole() - QAction::SoftKeyRole - Qt::WA_MergeSoftkeys - Qt::WA_MergeSoftkeysRecursively - Qt::WindowSoftkeysVisibleHint - Qt::WindowSoftkeysRespondHint * QLocale - [QTBUG-27987] Constructing a QLocale object with the short locale id has been improved. * QObject - Added overloads of connect() to connect using pointers to member function - Added QObject::isSignalConnected() QtGui ----- * Accessibility has been refactored. The hierachy of accessible objects is implemented via proper parent/child functions instead of using navigate which has been deprecated for this purpose. Table and cell interfaces have been added to qaccessible2.h * Touch events and points have been extended to hold additional information like capability flags, point-specific flags, velocity, and raw positions. * A new set of enabler classes have been added, most importantly QWindow, QScreen, QSurfaceFormat, and QOpenGLContext. * Most of the useful QtOpenGL classes have been polished and moved into QtGui. See QOpenGLFramebufferObject, QOpenGLShaderProgram, QOpenGLFunctions, etc. * QOpenGLPaintDevice has been added to be able to use QPainter to render into the currently bound context. * Behavioral change in QImage::fill() on an image with format Format_RGB888: For consistency with RGB32 and other 32-bit formats, function now expects image data in RGB layout as opposed to BGR layout. * Behavioral change in QImage and QPixmap load()/loadFromData() on a non-null image: If load() or loadFromData() fails to load the image (returns false) then the existent image data will be invalidated, so that isNull() is guaranteed to return true in this case. * Behavioral change regarding QPainter fill rules when not using antialiased painting: The fill rules have changed so that the aliased and antialiased coordinate systems match. Earlier 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 gives the same consistent rounding for images / pixmaps as for paths and rectangle filling. It's possible to still get the old behavior by setting the QPainter::Qt4CompatiblePainting render hint. * Behavioral change regarding QPen: The default QPen constructors now create a 1-width non-cosmetic pen as opposed to a 0-width cosmetic pen. The old behavior can be emulated by setting the QPainter::Qt4CompatiblePainting render hint when painting. QtWidgets --------- * A new style QFusionStyle has been introduced, while QPlastiqueStyle, QCleanlooksStyle, QCDEStyle and QMotifStyle have been removed. The older styles will be made available to applications as a standalone source package. * QInputContext removed as well as related getters and setters on QWidget and QApplication. Input contexts are now platform specific. * QInputDialog::getInteger() has been obsoleted. Use QInputDialog::getInt() instead. * In Qt 4, QStyle::standardIconImplementation() and layoutSpacingImplementation() were introduced instead of making the corresponding methods virtual due to binary compatibility reasons. QStyle::standardIcon() and layoutSpacing() have been made (pure) virtual in Qt 5. * In Qt 4, many QStyleOption subclasses were introduced in order to keep binary compatibility -- QStyleOption was designed to be extended this way, in fact it embeds a version number. In Qt 5 the various QStyleOption*V{2,3,4} classes have been removed, and their members merged into the respective base classes. Those classes were left as typedefs to keep existing code working. Still, some minor adjustements could be necessary, especially in code that uses QStyleOption directly and does not initialize all the members using the proper Qt API: due to the version bump, QStyle will try to use the additional QStyleOption members, which are left default-initialized. * QHeaderView has been refactored and the following functions have been obsoleted: * void setMovable(bool movable) - use void setSectionsMovable(bool movable) instead. * bool isMovable() const - use bool sectionsMovable() const instead. * void setClickable(bool clickable) - use void setSectionsClickable(bool clickable) instead. * bool isClickable() const - use bool sectionsClickable() instead. * void setResizeMode(int logicalindex, ResizeMode mode) - use setSectionResizeMode(logicalindex, mode) instead. * ResizeMode resizeMode(int logicalindex) const - use sectionResizeMode(int logicalindex) instead. * setSortIndicator will no longer emit sortIndicatorChanged when the sort indicator is unchanged. * QDateEdit and QTimeEdit have re-gained a USER property. These were originally removed before Qt 4.7.0, and are re-added for 5.0. This means that the userProperty for those classes are now QDate and QTime respectively, not QDateTime as they have been for the 4.7 and 4.8 releases. * QGraphicsItem and derived classes - Passing a QGraphicsScene in the items constructor is no longer supported. Construct the item without a scene and then call QGraphicsScene::addItem() to add the item to the scene. * QAbstractItemView and derived classes only emit the clicked() signal on left click now, instead of on all mouse clicks. * QProxyModel has been removed. It is deprecated since early Qt 4 versions and replaced by QAbstractProxyModel and related classes. A copy of QProxyModel is available in the UiHelpers library. * The virtual methods QApplication::commitData and QApplication::saveState, used for session management, no longer exist. Connect to the commitDataRequest and saveStateRequest signals instead. The new isSessionSaving() method can be used in the cases where the closeEvent of your window needs to know whether it is being called during shutdown. * [QTBUG-20503] QFileSystemModel no longer masks out write permissions from the permissions returned from permissions() or data(FilePermissions), even if in read-only mode (QFileSystemModel::isReadOnly()). * [QTBUG-158 QTBUG-428 QTBUG-26501] QComboBox::currentText improvements Restored currentText as USER property. New setter setCurrentText(), marked as WRITE method, usable by QItemDelegate and QDataWidgetMapper. New signal currentTextChanged() marked as NOTIFY method. QtNetwork --------- * QHostAddress::isLoopback() API added. Returns true if the address is one of the IP loopback addresses. * QSslCertificate::serialNumber() now always returns the serial number in hexadecimal format. * The openssl network backend now reads the ssl configuration file allowing the use of openssl engines. QtDBus ------ * QtDBus now generates property annotations for the Qt type names in the org.qtproject.QtDBus namespace. When parsing such annotations both the old and new namespaces are accepted. * QtDBus error codes have been updated to be on the org.qtproject.QtDBus.Error namespace. QtConcurrent ------------ * QtConcurrent is no longer in QtCore, but forms its own library now. QMake-based projects can use QT += concurrent to include the new library. * QtConcurrent::Exception has been renamed to QException, and is still in QtCore. Ditto QtConcurrent::UnhandledException. QtOpenGL -------- * Most of the classes in this module (with the notable exception of QGLWidget) now have equivalents in QtGui, along with the naming change QGL -> QOpenGL. The classes in QtOpenGL that have equivalents in QtGui can now be considered deprecated. * QGLPixelBuffer is now deprecated and implemented in terms of a hidden QGLWidget and a QOpenGLFramebufferObject. It is recommended that applications using QGLPixelBuffer for offscreen rendering to a texture switch to using QOpenGLFramebufferObject directly instead, for improved performance. * The default major version of QGLFormat has been changed to 2 to be aligned with QSurfaceFormat. Applications that want to use a different version should explicitly request it using QGLFormat::setVersion(). * void QGLContext::generateFontDisplayLists(const QFont& font, int listBase) and int QGLWidget::fontDisplayListBase(const QFont & fnt, int listBase) which were deprecated in Qt 4 have been removed. * Previously deprecated default value listBase parameter has been removed from both QGLWidget::renderText() functions. * In order to ensure support on more platforms, stricter requirements have been introduced for doing threaded OpenGL. First, you must call makeCurrent() at least once per swapBuffers() call, so that the platform has a chance to synchronize resizes to the OpenGL surface. Second, before doing makeCurrent() or swapBuffers() in a separate thread, you must call QGLContext::moveToThread(QThread *) 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. QtScript -------- * [QTBUG-2124] Added default conversion for long and unsigned long. * [QTBUG-6133] Fixed QScriptContextInfo::functionMetaIndex() for overloaded slots. * [QTBUG-15213] Doc: Added missing properties to the ECMAScript reference. * [QTBUG-15956] Doc: Removed wrong information about Error .stack properties. * [QTBUG-17915] Fixed a crash when a JS property descriptor was only partially defined. * [QTBUG-18188] Fixed a regression that caused contexts created by QScriptEngine::pushContext() to inherit the parent context's scope. * [QTBUG-18201] Suppressed 'LEAK' messages on stderr at application exit. * [QTBUG-20378] Fixed QtScriptTools compilation when some features are disabled. * [QTBUG-20845] Fixed a precision bug in the calculator example. * [QTBUG-21548] Fixed a crash in QScriptEngineDebugger when the QScriptEngine being debugged was deleted. * [QTBUG-21760] Fixed a crash when accessing QObject properties through an activation object. * [QTBUG-21896] Fixed a crash when converting an invalid JS value to a string. * [QTBUG-21993] Fixed a bug that caused QObject wrapper objects created with the PreferExistingWrapperObject option to not be garbage collected, even if the object was not referenced anywhere in the scripting environment. * [QTBUG-22152] Fixed build issue on Solaris. * [QTBUG-23871] Fixed a JIT crash on x86-64 caused by out-of-range branch instructions. * [QTBUG-26261] Fixed a crash when a queued signal handler no longer existed. * [QTBUG-26590] Fixed a bug that caused QObjects with script connections to not be garbage collected as expected. QTestLib -------- * [QTBUG-20615] Autotests can now log test output to multiple destinations and log formats simultaneously. * [QTBUG-21645] QSignalSpy now handles QVariant signal parameters more intuitively; the QVariant value is copied directly, instead of being wrapped inside a new QVariant. This means that calling qvariant_cast() on the QSignalSpy item (to "unwrap" the value) is no longer required (but still works). QtSql ----- QSqlQueryModel/QSqlTableModel/QSqlRelationalTableModel * The dataChanged() signal is now emitted for changes made to an inserted record that has not yet been committed. Previously, dataChanged() was suppressed in this case for OnRowChange and OnFieldChange. This was probably an attempt to avoid trouble if setData() was called while handling primeInsert(). By emitting dataChanged(), we ensure that all views are aware of the change. * While handling primeInsert() signal, the record must be manipulated using the provided reference. Do not attempt to manipulate the records using the model methods setData() or setRecord(). * removeRows() no longer emits extra beforeDelete signal for out of range row. * removeRows() now requires the whole range of targetted rows to be valid before doing anything. Previously, it would remove what it could and ignore the rest of the range. * removeRows(), for OnFieldChange and OnRowChange, allows only 1 row to be removed and only if there are no other changed rows. * setRecord() and insertRecord() -The generated flags from the source record are preserved in the model and determine which fields are included when changes are applied to the database. -Require all fields to map correctly. Previously fields that didn't map were simply ignored. -For OnManualSubmit, insertRecord() no longer leaves behind an empty row if setRecord() fails. -setRecord() now automatically submits for OnRowChange. * QSqlQueryModel::indexInQuery() is now virtual. See QSqlTableModel::indexInQuery() as example of how to implement in a subclass. * QSqlQueryMode::setQuery() emits fewer signals. The modelAboutToBeReset() and modelReset() signals suffice to inform views that they must reinterrogate the model. * QSqlTableModel::select() is now a slot. * QSqlTableModel::selectRow(): This is a new slot that refreshes a single row in the model from the database. * QSqlTableModel edit strategies OnFieldChange/OnRowChange QTBUG-2875 Previously, after changes were submitted in these edit strategies, select() was called which removed and inserted all rows. This ruined navigation in QTableView. Now, with these edit strategies, there is no implicit select() done after committing. This includes deleted rows which remain in the model as blank rows until the application calls select(). Instead, selectRow() is called to refresh only the affected row. * QSqlTableModel::isDirty(): New overloaded method to check whether model has any changes to submit. QTBUG-3108 * QSqlTableModel::setData() and setRecord() no longer revert pending changes that fail upon resubmitting for edit strategies OnFieldChange and OnRowChange. Instead, pending (failed) changes cause new changes inappropriate to the edit strategy to be refused. The application should resolve or revert pending changes. insertRows() and insertRecord() also respect the edit strategy. * QSqlTableModel::setData() and setRecord() in OnRowChange no longer have the side effect of submitting the cached row when invoked on a different row. * QSqlDriver::subscribeToNotification, unsubscribeFromNotification, subscribedToNotifications, isIdentifierEscaped, and stripDelimiters are now virtual. Their xxxImplemenation counterparts have been removed now that QSqlDriver subclasses can reimplement these directly. **************************************************************************** * Database Drivers * **************************************************************************** sqlite ------ * QVariant::Bool type now mapped to integers 0/1 in SQL instead of strings 'true' and 'false'. Sqlite does not have a boolean column type and it is customary to use integer. QTBUG-23895 postgres -------- * the error message returned in QSqlError::text() has the SQLSTATE error code appended in parantheses. **************************************************************************** * Platform Specific Changes * **************************************************************************** The Qt platform implementations have been rewritten as plugins for the Qt Platform Abstraction (QPA): * The platform plugin(s) needs to be bundled when applications are deployed. * The platform implementations are in large parts rewrites. * Q_WS_* defines are no longer defined. Q_OS_* is. * Some platform specific functionality and API is missing from the 5.0 release and will be added later. * Platform spesific functionality will be added in separate modules: QtMacExtras: http://qt.gitorious.org/qtplayground/qtmacextras Qt for Linux/X11 ---------------- Qt for Windows -------------- * Accessibility framework uses IAccessible2 * ANGLE can be used to provide Open GL ES 2.0 (see http://code.google.com/p/angleproject/) Qt for Mac OS X --------------- * Qt now uses Cocoa, the Carbon port has been removed. * The minimum supported OS X version is 10.6. PPC is not supported. * Qt generally supports cross OS X version build and deployment (build on any supported version and deploy to any other). One exception is QtWebkit, which should be built using the 10.6 SDK if you want to target that platform. * The Qt binary installer has been changed to use the Qt installer framework. Qt is now installed into one location instead of being spread out over multiple directories. * The Qt binary installer is built against the 10.7 SDK and does not run on 10.6. * The Clang compiler is used by default. Gcc is available trough the macx-g++* mkspecs. * Build-system support for universal binaries has been removed. The "lipo" command-line tool can be used as a workaround. * Qt now use the raster paint engine on all platforms for drawing widgets. CoreGraphics is still used for printing on Mac. * Support for high-dpi "retina" displays has been added for widgets, OpenGL and QtQuick. * The unified toolbar implementation from Qt 4 has not and will not be ported to Qt 5. This means calling QMainWindow::setUnifiedTitleAndToolBarOnMac has no effect on Qt 5. A replacement API which wraps NSToolbar is available in QtMacExtras. * MacDeployQt plugin deployment has been improved. It will no longer try to deploy all plugins with all dependencies. * Qt has been updated to be in compliance with the Mac App Store sandbox, and will for example no longer try to write settings to files outside the sandbox. * The "qt_menu.nib" issue preventing static/non-framework builds from working has been fixed. Qt for Embedded Linux --------------------- Qt for Windows CE ----------------- **************************************************************************** * Compiler Specific Changes * **************************************************************************** **************************************************************************** * Tools * **************************************************************************** - Build System * Qt has been split into numerous repositories. Configure covers mostly only qtbase's options. * Qt will now install CMake configuration files for all its libraries. - configure * The Mac OS X -dwarf2 configure argument has been removed. DWARF2 is always used on Mac OS X now. * The following options have been added: (-no)-force-asserts, (-no)-strip, (-no)-gui & (-no)-widgets, -device & -device-option, -archdatadir, -libexecdir & -qmldir, and numerous changes relating to specific Qt features and dependencies. * Configure will no longer call "qmake -recursive" by default, as the subsequent build invokes qmake as needed. Use -fully-process to restore the old behavior. - qmake * default_pre.prf is now evaluated per subproject & build pass, symmetrically to default_post.prf. * .qmake.conf files (.qmake.cache equivalent in source tree) are read now. * Project-specific mkspecs/ and features/ directories are supported now. QMAKEPATH and QMAKEFEATURES can be set in .qmake.{config,cache} to specifiy their location, and qmake will find them in the project's top-level directory automatically. * Mixing host and target subprojects is now supported. "default-host" makespec was added; option(host_build) enables its use. * QMAKE_MOC_OPTIONS variable is now available for passing additional parameters to the moc. * The CROSS_COMPILE variable and property can be used to parametrize the device and mingw makespecs. * QMAKE_RPATHLINKDIR (complementary to QMAKE_RPATHDIR) is now understood. * The "aux" TEMPLATE was added. Does not work with vcproj and xcode output files. * The properties QT_INSTALL_ARCHDATA, QT_INSTALL_LIBEXECS, QT_INSTALL_QML, QMAKE_SPEC & QMAKE_XSPEC were added. QT_INSTALL_DEMOS is obsolete. * The following functions have been added: $$sort_depends, $$resolve_depends, $$enumerate_vars, $$reverse, $$val_escape, $$format_number, $$shadowed, $$clean_path, $$system_path, $$shell_path, $$absolute_path, $$relative_path, $$system_quote, $$shell_quote, cache, write_file, touch, mkpath & log. defined can now query variables; $$cat and $$system support more splitting modes. qtCompileTest (available from configure.prf) was added. * Removed qttest_p4.prf. Use CONFIG+=testcase and other flags instead. * QMAKE_SUBSTITUTES can now copy files verbatim. * MSVC desktop builds now use -Zc:wchar_t. * The following variables were added: QMAKESPEC, _QMAKE_CONF_ & _QMAKE_SUPER_CACHE_. * QDBUSXML2CPP_{INTERFACES,ADAPTORS}_{HEADER,SOURCE}_FLAGS are now understood, and DBUS_{INTERFACES,ADAPTORS} support file groups with individual flags now. * QT_PRIVATE and PKGCONFIG_PRIVATE (analogous to LIBS_PRIVATE resp. PKGCONFIG) are now understood. * INSTALLS entries now support copying with subdirectory (e.g., entry.base = $$dirname(PWD)). * Defining QTPLUGIN in dynamically linked projects does not hurt any more. * CONFIG+=import_plugins will now cause plugin imports for QTPLUGIN being auto-generated. * Debug info generation can now be enabled also for release builds (CONFIG+=force_debug_info). * The following CONFIG flags have been deprecated in favor of QT module entries: qtestlib, qdbus, help, designer, uitools, qaxserver & qaxcontainer (the leading 'q' was stripped from the affected modules). * The IN_PWD alias for PWD was deprecated. * QMAKE_{DIST,}CLEAN support normalized path separators now. * CONFIG+=depend_includepath is on by default now. DEPENDPATH is unnecessary in most projects. * Makespecs should be adjusted in the following ways: * The QMAKE_INCDIR_QT, QMAKE_LIBDIR_QT, QMAKE_MOC, QMAKE_UIC, QMAKE_IDC, TEMPLATE & QT variables should not be defined any more. Furthermore, QMAKE_LIBS_X11SM is obsolete. * The qt, warn_on, release, & link_prl CONFIG flags should not be set any more. * The QMAKE_PLATFORM & QMAKE_COMPILER variables should be defined now. Several other variables should be defined by including files from mkspecs/common/. - Assistant - Designer * [QTBUG-8926] [QTBUG-20440] Properties of type QStringList now have translation attributes which apply to all items. They are by default translatable. - Linguist * The integration with Mac OS' document handling was improved * lupdate can now treat other .ts files as sources * lupdate's CODECFORTR is deprecated and will be removed soon. All source code written with Qt is expected to use UTF-8 encoding. - rcc - moc * [QTBUG-20785] The moc now has a -b option to #include an additional file at the beginning of the generated file. * moc is now able to fully understand and expands preprocessor macros. - uic - qtconfig **************************************************************************** * Plugins * **************************************************************************** - The text codecs that were previously plugins are now built into QtCore. - Code using Q_EXPORT_PLUGIN macros will no longer compile. Use Q_PLUGIN_METADATA instead. Note that this requires that the class be default-constructible. **************************************************************************** * Important Behavior Changes * **************************************************************************** - QPointer * The implementation of QPointer has been changed to use QWeakPointer. The old guard mechanism has been removed. This causes a slight change in behavior when using QPointer: * When using QPointer on a QWidget (or a subclass of QWidget), previously the QPointer would be cleared by the QWidget destructor. Now, the QPointer is cleared by the QObject destructor (since this is when QWeakPointers are cleared). Any QPointers tracking a widget will NOT be cleared before the QWidget destructor destroys the children for the widget being tracked. - QUrl * QUrl has been changed to operate only on percent-encoded forms. Fully-decoded forms, where the percent character stands for itself, are no longer possible. For that reason, the getters and setters with "encoded" in the name are deprecated, except for QUrl::toEncoded() and QUrl::fromEncoded(). QUrl now operates in a mode where it decodes as much as it can of the percent-encoding sequences. In addition, the setter methods possess a mode in which a '%' character not part of a percent-encoding sequence will cause the parser to correct the input. Therefore, most software will not require changes to adapt, since the getter methods will continue returning the components in their most-decoded form as they did before and the setter methods will accept input as they did before.. The most notable difference is when dealing with QUrl::toString(). Previously, this function would return percent characters in the URL by themselves. Now, it will return "%25", like QUrl::toEncoded(). - QLibraryInfo * location() always returns paths with normalized separators now. - QVariant * Definition of QVariant::UserType changed. Currently it is the same as QMetaType::User, which means that it points to the first registered custom type, instead of a nonexistent type. - QMetaType * Interpretation of QMetaType::Void was changed. Before, in some cases it was returned as an invalid type id, but sometimes it was used as a valid type (C++ "void"). In Qt5, new QMetaType::UnknownType was introduced to distinguish between these two. QMetaType::UnknownType is an invalid type id signaling that a type is unknown to QMetaType, and QMetaType::Void is a valid type id of C++ void type. The difference will be visible for example in call to QMetaType::typeName(), this function will return null for QMetaType::UnknownType and a pointer to "void" string for QMetaType::Void. Please, notice that QMetaType::UnknownType has value 0, which previously was reserved for QMetaType::Void. - QWidget * No need to set the application name in setWindowTitle() anymore, this is done automatically, on Windows and Unix/X11, provided that the (possibly translated) application display name is set with QGuiApplication::setApplicationDisplayName(). - QMessageBox * The static function QMessageBox::question has changed the default argument for buttons. Before the default was to have an Ok button. That is changed to having a yes and a no button. - qmake & configure * The project file parser has been rewritten from scratch. Invalid syntax will be rejected more aggressively, and interpretation may have changed in some corner cases. * Projects which explicitly set an empty TARGET are considered broken now. * The makespec and .qmake.cache do not see build pass specific variables any more. * load()/include() with a target namespace and infile()/$$fromfile() now start with an entirely pristine context. * Configure's -sysroot and -hostprefix are now handled slightly differently. The QT_INSTALL_... properties are now automatically prefixed with the sysroot; the raw values are available as QT_INSTALL_.../raw and the sysroot as QT_SYSROOT. The new QT_HOST_... properties can be used to refer to the Qt host tools. -no-gcc-sysroot can be used for non-standard sysroot configurations. * The QMAKE_MKSPECS property became unavailable at the command line. Query QT_HOST_DATA instead. * The TEMPLATE_PREFIX variable is gone. Use contains(TEMPLATE, vc.*) instead. * The "default" makespec symlink/directory is gone. Use qmake -query QMAKE_XSPEC instead. * DEPENDPATH does not end up in VPATH any more. Some SOURCES may not be found any more. * Several functions and built-in variables were modified to return normalized paths. * The -(no-)exception flags in configure have been removed. Qt modules are now compiled without exceptions by default, as they do not use them and can neither handle them properly. Qt Core still has exceptions enabled to correctly throw bad_alloc exceptions in our tool classes. Whether code should be compiled with exception support enabled or disabled can be controlled by a CONFIG += exceptions/exceptions_off setting in the .pro file. * The -no/-stl configure options are gone. Qt always uses the STL now. * The -no/-fast configure options are gone. * The -prefix-install configure option is gone. Use -prefix, etc. instead. * The -make option of the Windows configure was renamed to -make-tool. -make now complements -no-make, like in the Unix version. * The object_with_source CONFIG flag was removed. Use object_parallel_to_source instead. * Support for universal binaries on Mac OS has been removed. * The processor architecture handling changed significantly. This affects the -arch & -*-endian configure options, the QT_ARCH qmake variable, and more. * No "make_default" make targets will be generated any more. Use "make_first" instead. * The "qmake" make targets are non-recursive now. Use "qmake_all" to recurse. * load() with paths relative to the current project is not supported any more. Use include() instead. * Persistent qmake properties are not versioned any more. Also, the vendor changed to "QtProject", so old settings are lost. * Support for the Borland toolchain was removed. Numerous obsolete makespecs were culled. * setcepaths.bat is gone. QMake-generated Makefiles are self-contained now. * moc_dir, rcc_dir and some other tool variables are not defined in Qt's .pc files any more; the generic host_bins is defined instead.