What's New in Qt 4.8

Qt 4.8 provides many improvements and enhancements over the previous releases in the Qt 4 series. This document covers the most important features in this release, separated by category.

A list of other Qt 4 features can be found on the What's New in Qt 4 page.

Qt Quick 1.1

Qt Quick 1.1 introduces new changes such as new properties and better performance.

  • Right-To-Left text support
  • Improved image caching
  • Text input improvements - Support for split-screen virtual keyboard
  • PinchArea Element - enables simple pinch gesture handling
  • New properties for QML Elements.

Qt Platform Abstraction -- Lighthouse

QPA allows porting Qt to different windowing systems and devices easier. It provides a clean abstraction layer for porting QtGui to new window systems.

Note: QPA is considered an experimental feature in Qt 4.8. In Qt 5 it is a supported and complete feature.

Qt WebKit 2.2

The new Qt WebKit release introduces bug fixes, performance improvements, and greater compiler compatibility.

Threaded OpenGL

Many Qt OpenGL functions are now thread-safe. Threads that cater to different situations are now available.

  • Buffer swapping thread
  • Texture uploading thread
  • QPainter thread

Deprecated Items in Qt 4.8

As part of Open Governance, modules in Qt 4.8 will receive maintainers and receive different support levels.

Currently, a module has an activity classification, the Module Maturity Level. As well, a list of modules and their maturity level is in the Qt Developer Network.

Additions to the Qt API

Qt 4.8 introduces changes to the Qt API.

New Classes, Functions, Macros, etc.

New Classes

New Member Functions

Class QGraphicsWebView:

QPainter::RenderHints renderHints() const
void setRenderHint(QPainter::RenderHint hint, bool enabled = true)
void setRenderHints(QPainter::RenderHints hints)

Class QWebPage:


Class QThreadPool:

bool waitForDone(int msecs)

Class QProcessEnvironment:

void insert(const QProcessEnvironment & e)
QStringList keys() const

Class QUrl:

bool isLocalFile() const
void swap(QUrl & other)
QString topLevelDomain() const

Class QAbstractItemModel:


Class QObject:

bool connect(const QObject * sender, const QMetaMethod & signal, const QObject * receiver, const QMetaMethod & method, Qt::ConnectionType type = Qt::AutoConnection)
bool disconnect(const QObject * sender, const QMetaMethod & signal, const QObject * receiver, const QMetaMethod & method)
int senderSignalIndex() const

Class QSharedMemory:

QString nativeKey() const
void setNativeKey(const QString & key)

Class QTranslator:

bool load(const QLocale & locale, const QString & filename, const QString & prefix = QString(), const QString & directory = QString(), const QString & suffix = QString())

Class QVariant:

void swap(QVariant & other)

Class QUuid:

QUuid fromRfc4122(const QByteArray & bytes)
QByteArray toByteArray() const
QByteArray toRfc4122() const

Class QBitArray:

void swap(QBitArray & other)

Class QByteArray:

void swap(QByteArray & other)

Class QContiguousCache:

void swap(QContiguousCache<T> & other)

Class QChar:

UnicodeVersion currentUnicodeVersion()

Class QElapsedTimer:

qint64 nsecsElapsed() const

Class QHash:

void swap(QHash<Key, T> & other)

Class QMultiHash:

void swap(QMultiHash<Key, T> & other)

Class QLinkedList:

void swap(QLinkedList<T> & other)

Class QList:

void swap(QList<T> & other)

Class QLocale:

QString bcp47Name() const
QString createSeparatedList(const QStringList & list) const
QString currencySymbol(CurrencySymbolFormat format = CurrencySymbol) const
Qt::DayOfWeek firstDayOfWeek() const
QList<QLocale> matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Country country)
QString nativeCountryName() const
QString nativeLanguageName() const
QString quoteString(const QString & str, QuotationStyle style = StandardQuotation) const
QString quoteString(const QStringRef & str, QuotationStyle style = StandardQuotation) const
Script script() const
QString scriptToString(Script script)
QString toCurrencyString(qlonglong value, const QString & symbol = QString()) const
QString toCurrencyString(qulonglong value, const QString & symbol = QString()) const
QString toCurrencyString(short value, const QString & symbol = QString()) const
QString toCurrencyString(ushort value, const QString & symbol = QString()) const
QString toCurrencyString(int value, const QString & symbol = QString()) const
QString toCurrencyString(uint value, const QString & symbol = QString()) const
QString toCurrencyString(double value, const QString & symbol = QString()) const
QString toCurrencyString(float value, const QString & symbol = QString()) const
QString toLower(const QString & str) const
QString toUpper(const QString & str) const
QStringList uiLanguages() const
QList<Qt::DayOfWeek> weekdays() const

Class QMap:

void swap(QMap<Key, T> & other)

Class QQueue:

void swap(QQueue<T> & other)

Class QPoint:

QPoint & operator*=(float factor)
QPoint & operator*=(double factor)
QPoint & operator*=(int factor)

Class QMultiMap:

void swap(QMultiMap<Key, T> & other)

Class QRegExp:

void swap(QRegExp & other)

Class QSet:

void swap(QSet<T> & other)

Class QString:

bool contains(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int count(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(const QStringRef & s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf(const QStringRef & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf(const QStringRef & str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(const QStringRef & s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
void swap(QString & other)

Class QStack:

void swap(QStack<T> & other)

Class QStringRef:

bool contains(const QString & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int count(const QString & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int count(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(const QString & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf(const QString & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf(QChar ch, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf(QLatin1String str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf(const QStringRef & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf(const QString & str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf(QChar ch, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf(QLatin1String str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf(const QStringRef & str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(const QString & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith(const QStringRef & str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
QByteArray toAscii() const
QByteArray toLatin1() const
QByteArray toLocal8Bit() const
QVector<uint> toUcs4() const
QByteArray toUtf8() const

Class QVarLengthArray:

iterator begin()
const_iterator begin() const
const_iterator constBegin() const
const_iterator constEnd() const
iterator end()
const_iterator end() const
iterator erase(iterator begin, iterator end)
iterator erase(iterator pos)
void insert(int i, const T & value)
void insert(int i, int count, const T & value)
iterator insert(iterator before, int count, const T & value)
iterator insert(iterator before, const T & value)
QVarLengthArray<T, Prealloc> & operator+=(const T & value)
QVarLengthArray<T, Prealloc> & operator<<(const T & value)
void prepend(const T & value)
void remove(int i)
void remove(int i, int count)
void replace(int i, const T & value)

Class QVector:

void swap(QVector<T> & other)

Class QXmlStreamWriter:

bool hasError() const

Class QDBusAbstractInterface:

void setTimeout(int timeout)
int timeout() const

Class QDBusConnection:

QDBusConnection connectToPeer(const QString & address, const QString & name)
ConnectionCapabilities connectionCapabilities() const
void disconnectFromPeer(const QString & name)
QByteArray localMachineId()

Class QGraphicsGridLayout:

void removeItem(QGraphicsLayoutItem * item)

Class QGraphicsLayout:


Class QBitmap:

void swap(QBitmap & other)

Class QIcon:

void swap(QIcon & other)

Class QImage:

void fill(const QColor & color)
void fill(Qt::GlobalColor color)
void swap(QImage & other)

Class QPicture:

void swap(QPicture & other)

Class QPixmap:

void swap(QPixmap & other)

Class QAbstractProxyModel:

virtual QModelIndex buddy(const QModelIndex & index) const
virtual bool canFetchMore(const QModelIndex & parent) const
virtual void fetchMore(const QModelIndex & parent)
virtual bool hasChildren(const QModelIndex & parent = QModelIndex()) const
virtual QMimeData * mimeData(const QModelIndexList & indexes) const
virtual QStringList mimeTypes() const
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder)
virtual QSize span(const QModelIndex & index) const
virtual Qt::DropActions supportedDropActions() const

Class QApplication:

Qt::KeyboardModifiers queryKeyboardModifiers()

Class QFileOpenEvent:

bool openFile(QFile & file, QIODevice::OpenMode flags) const

Class QKeySequence:

void swap(QKeySequence & other)

Class QSizePolicy:

bool hasWidthForHeight() const
void setWidthForHeight(bool dependent)

Class QWidget:

(preliminary) QPlatformWindow * platformWindow() const
QPlatformWindowFormat platformWindowFormat() const
(preliminary) void setPlatformWindow(QPlatformWindow * window)
void setPlatformWindowFormat(const QPlatformWindowFormat & format)

Class QBrush:

void swap(QBrush & other)

Class QRadialGradient:

qreal centerRadius() const
qreal focalRadius() const
void setCenterRadius(qreal radius)
void setFocalRadius(qreal radius)

Class QPainter:

QRectF clipBoundingRect() const
void drawGlyphRun(const QPointF & position, const QGlyphRun & glyphs)
void drawPixmapFragments(const QRectF * targetRects, const QRectF * sourceRects, int fragmentCount, const QPixmap & pixmap, PixmapFragmentHints hints = 0)

Class QPainterPath:

void swap(QPainterPath & other)

Class QPolygon:

void swap(QPolygon & other)

Class QPen:

void swap(QPen & other)

Class QPolygonF:

void swap(QPolygonF & other)

Class QPrinterInfo:

QPrinterInfo & operator=(const QPrinterInfo & other)

Class QRegion:

void swap(QRegion & other)

Class QFont:

HintingPreference hintingPreference() const
void setHintingPreference(HintingPreference hintingPreference)
void setStyleName(const QString & styleName)
QString styleName() const

Class QFontMetrics:

bool inFontUcs4(uint character) const

Class QFontInfo:

QString styleName() const

Class QFontMetricsF:

bool inFontUcs4(uint ch) const

Class QTextDocument:

Qt::CursorMoveStyle defaultCursorMoveStyle() const
void setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)

Class QTextCharFormat:

QFont::HintingPreference fontHintingPreference() const
void setFontHintingPreference(QFont::HintingPreference hintingPreference)

Class QTextBlockFormat:

qreal lineHeight(qreal scriptLineHeight, qreal scaling) const
qreal lineHeight() const
int lineHeightType() const
void setLineHeight(qreal height, int heightType)

Class QTextListFormat:

QString numberPrefix() const
QString numberSuffix() const
void setNumberPrefix(const QString & numberPrefix)
void setNumberSuffix(const QString & numberSuffix)

Class QTextLayout:

Qt::CursorMoveStyle cursorMoveStyle() const
QList<QGlyphRun> glyphRuns() const
int leftCursorPosition(int oldPos) const
int rightCursorPosition(int oldPos) const
void setCursorMoveStyle(Qt::CursorMoveStyle style)

Class QUndoCommand:

QString actionText() const

Class QCheckBox:

virtual QSize minimumSizeHint() const

Class QLineEdit:

Qt::CursorMoveStyle cursorMoveStyle() const
void setCursorMoveStyle(Qt::CursorMoveStyle style)

Class QRadioButton:

virtual QSize minimumSizeHint() const

Class QTabWidget:

virtual int heightForWidth(int width) const

Class QNetworkAccessManager:

QNetworkReply * post(const QNetworkRequest & request, QHttpMultiPart * multiPart)
QNetworkReply * put(const QNetworkRequest & request, QHttpMultiPart * multiPart)

Class QNetworkReply:

void setFinished(bool finished)

Class QNetworkConfigurationManager:

void configurationRemoved(const QNetworkConfiguration & config)

Class QNetworkProxyQuery:

void setNetworkConfiguration(const QNetworkConfiguration & networkConfiguration)

Class QNativeSocketEngine:

virtual bool joinMulticastGroup(const QHostAddress & groupAddress, const QNetworkInterface & iface)
virtual bool leaveMulticastGroup(const QHostAddress & groupAddress, const QNetworkInterface & iface)
virtual QNetworkInterface multicastInterface() const
virtual bool setMulticastInterface(const QNetworkInterface & iface)

Class QUdpSocket:

bool joinMulticastGroup(const QHostAddress & groupAddress)
bool joinMulticastGroup(const QHostAddress & groupAddress, const QNetworkInterface & iface)
bool leaveMulticastGroup(const QHostAddress & groupAddress)
bool leaveMulticastGroup(const QHostAddress & groupAddress, const QNetworkInterface & iface)
QNetworkInterface multicastInterface() const
void setMulticastInterface(const QNetworkInterface & iface)

Class QSslConfiguration:

bool testSslOption(QSsl::SslOption option) const

Class QSslSocket:

QString peerVerifyName() const
void setPeerVerifyName(const QString & hostName)

Class QGLFormat:

QGLFormat fromPlatformWindowFormat(const QPlatformWindowFormat & format)
QPlatformWindowFormat toPlatformWindowFormat(const QGLFormat & format)

Class QGLContext:

QGLContext * fromPlatformGLContext(QPlatformGLContext * platformContext)

Class QGLFramebufferObjectFormat:

bool mipmap() const
void setMipmap(bool enabled)

Class QSqlRelationalTableModel:

void setJoinMode(QSqlRelationalTableModel::JoinMode joinMode)

Class QHelpSearchQueryWidget:

void collapseExtendedSearch()
void expandExtendedSearch()
void setQuery(const QList<QHelpSearchQuery> & queryList)

New Global Functions

bool operator!=(const QPlatformWindowFormat & a, const QPlatformWindowFormat & b)
bool operator!=(const QVarLengthArray<T, Prealloc1> & left, const QVarLengthArray<T, Prealloc2> & right)
const QPoint operator*(int factor, const QPoint & point)
const QPoint operator*(double factor, const QPoint & point)
const QPoint operator*(float factor, const QPoint & point)
const QPoint operator*(const QPoint & point, int factor)
const QPoint operator*(const QPoint & point, double factor)
const QPoint operator*(const QPoint & point, float factor)
bool operator==(const QPlatformWindowFormat & a, const QPlatformWindowFormat & b)
bool operator==(const QVarLengthArray<T, Prealloc1> & left, const QVarLengthArray<T, Prealloc2> & right)

New Macros

Q_LIKELY( expr)
Q_UNLIKELY( expr)

New Enum Types

enum ConnectionCapability { UnixFileDescriptorPassing }
enum FileHandleFlag { AutoCloseHandle, DontCloseHandle }
enum HintingPreference { PreferDefaultHinting, PreferNoHinting, PreferVerticalHinting, PreferFullHinting }
enum CurrencySymbolFormat { CurrencyIsoCode, CurrencySymbol, CurrencyDisplayName }
enum QuotationStyle { StandardQuotation, AlternateQuotation }
enum Script { AnyScript, ArabicScript, CyrillicScript, DeseretScript, ..., TifinaghScript }
enum JoinMode { InnerJoin, LeftJoin }
enum LineHeightTypes { SingleHeight, ProportionalHeight, FixedHeight, MinimumHeight, LineDistanceHeight }
enum CursorMoveStyle { LogicalMoveStyle, VisualMoveStyle }

New Typedefs

typedef const_reference
typedef reference
typedef value_type

New Properties

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.