New Classes and Functions in Qt 5.2

This page contains a comprehensive list of all new classes and functions introduced in Qt 5.2. Links to new APIs in previous Qt 5 releases are found at the bottom of this page.

New Namespaces

namespace QBluetooth
namespace QtMac

New Classes

New Member Functions

Class QBitArray:

QBitArray &operator=(QBitArray &&other)

Class QByteArray:

QByteArray fromBase64(const QByteArray &base64, QByteArray::Base64Options options)
QByteArray &operator=(QByteArray &&other)
QByteArray toBase64(QByteArray::Base64Options options) const

Class QCommandLineOption:

QCommandLineOption &operator=(QCommandLineOption &&other)

Class QContiguousCache:

QContiguousCache<T> &operator=(QContiguousCache<T> &&other)

Class QDateTime:

QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetSeconds)
QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone)
bool isDaylightTime() const
int offsetFromUtc() const
void setOffsetFromUtc(int offsetSeconds)
void setTimeZone(const QTimeZone &toZone)
QTimeZone timeZone() const
QString timeZoneAbbreviation() const
QDateTime toOffsetFromUtc(int offsetSeconds) const
QDateTime toTimeZone(const QTimeZone &timeZone) const

Class QDir:

QDir &operator=(QDir &&other)

Class QEasingCurve:

QEasingCurve &operator=(QEasingCurve &&other)

Class QExplicitlySharedDataPointer:

QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other)

Class QFileInfo:

bool exists(const QString &file)
QFileInfo &operator=(QFileInfo &&other)

Class QHash:

QHash<K, V> &operator=(QHash<K, V> &&other)

Class QJsonValue:

int toInt(int defaultValue) const

Class QLinkedList:

QLinkedList<T> &operator=(QLinkedList<T> &&other)

Class QList:

QList<T> &operator=(QList<T> &&other)

Class QMap:

T &first()
const T &first() const
const Key &firstKey() const
T &last()
const T &last() const
const Key &lastKey() const
QMap<Key, T> &operator=(QMap<Key, T> &&other)

Class QMetaType:

bool compare(const void *lhs, const void *rhs, int typeId, int *result)
bool convert(const void *from, int fromTypeId, void *to, int toTypeId)
bool debugStream(QDebug &dbg, const void *rhs, int typeId)
bool hasRegisteredComparators()
bool hasRegisteredComparators(int typeId)
bool hasRegisteredConverterFunction(int fromTypeId, int toTypeId)
bool hasRegisteredConverterFunction()
bool hasRegisteredDebugStreamOperator()
bool hasRegisteredDebugStreamOperator(int typeId)
bool registerComparators()
bool registerConverter()
bool registerConverter(MemberFunction function)
bool registerConverter(MemberFunctionOk function)
bool registerConverter(UnaryFunction function)

Class QMimeType:

QMimeType &operator=(QMimeType &&other)

Class QObject:

QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)

Class QPair:

QPair<T1, T2> &operator=(const QPair<TT1, TT2> &p)
QPair<T1, T2> &operator=(QPair<TT1, TT2> &&p)

Class QPersistentModelIndex:

QPersistentModelIndex &operator=(QPersistentModelIndex &&other)

Class QProcess:

QProcess::InputChannelMode inputChannelMode() const
QString nullDevice()
void setInputChannelMode(QProcess::InputChannelMode mode)

Class QRegExp:

QRegExp &operator=(QRegExp &&other)

Class QSharedDataPointer:

QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other)

Class QString:

QString fromCFString(CFStringRef string)
QString fromNSString(const NSString *string)
QString &operator=(QString &&other)
CFStringRef toCFString() const
NSString *toNSString() const

Class QStringRef:

QStringRef left(int n) const
QStringRef mid(int position, int n) const
QStringRef right(int n) const

Class QThread:


Class QThreadPool:

void clear()

Class QUrl:

QUrl adjusted(QUrl::FormattingOptions options) const
QString fileName(QUrl::ComponentFormattingOptions options) const
QUrl fromCFURL(CFURLRef url)
QUrl fromNSURL(const NSURL *url)
bool matches(const QUrl &url, QUrl::FormattingOptions options) const
QUrl &operator=(QUrl &&other)
CFURLRef toCFURL() const
NSURL *toNSURL() const

Class QUrlQuery:

QUrlQuery &operator=(QUrlQuery &&other)

Class QVariant:

QVariant &operator=(QVariant &&other)

Class QVector:

int length() const
QVector<T> &operator=(QVector<T> &&other)
void removeAt(int i)
T takeAt(int i)

Class QAbstractTextDocumentLayout:

void unregisterHandler(int objectType, QObject *component)

Class QBrush:

QBrush &operator=(QBrush &&other)

Class QColor:

QString name(QColor::NameFormat format) const

Class QCursor:

QCursor &operator=(QCursor &&other)

Class QFont:

QFont &operator=(QFont &&other)

Class QFontDatabase:

QFont systemFont(QFontDatabase::SystemFont type)

Class QFontMetrics:

QFontMetrics &operator=(QFontMetrics &&other)

Class QGuiApplication:

Qt::ApplicationState applicationState()
void applicationStateChanged(Qt::ApplicationState state)
void sync()

Class QIcon:

QIcon &operator=(QIcon &&other)

Class QImage:

QImage &operator=(QImage &&other)

Class QKeySequence:

QKeySequence &operator=(QKeySequence &&other)

Class QNativeGestureEvent:

Qt::NativeGestureType gestureType() const
const QPoint globalPos() const
const QPointF &localPos() const
const QPoint pos() const
const QPointF &screenPos() const
qreal value() const
const QPointF &windowPos() const

Class QPainterPath:

QPainterPath &operator=(QPainterPath &&other)

Class QPalette:

QPalette &operator=(QPalette &&other)

Class QPen:

QPen &operator=(QPen &&other)

Class QPicture:

QPicture &operator=(QPicture &&other)

Class QPixmap:

QPixmap &operator=(QPixmap &&other)

Class QPlatformFontDatabase:

void registerAliasToFontFamily(const QString &familyName, const QString &alias)

Class QPlatformIntegration:

virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const
virtual void sync()

Class QPlatformTheme:

virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const

Class QRegion:

QRegion &operator=(QRegion &&other)

Class QTouchDevice:

int maximumTouchPoints() const

Class QVector2D:

float &operator[](int i)
float operator[](int i) const

Class QVector3D:

float &operator[](int i)
float operator[](int i) const

Class QVector4D:

float &operator[](int i)
float operator[](int i) const

Class QWheelEvent:

Qt::ScrollPhase phase() const

Class QNetworkAccessManager:

void connectToHost(const QString &hostName, quint16 port)
void connectToHostEncrypted(const QString &hostName, quint16 port, const QSslConfiguration &sslConfiguration)
QStringList supportedSchemes() const
QStringList supportedSchemesImplementation() const

Class QNetworkConfiguration:

QNetworkConfiguration::BearerType bearerTypeFamily() const

Class QSslConfiguration:

QByteArray sessionTicket() const
int sessionTicketLifeTimeHint() const
void setSessionTicket(const QByteArray &sessionTicket)

Class QQuickWindow:


Class QPressureReading:

void setTemperature(qreal temperature)

Class QSerialPort:

QSerialPort::Handle handle() const

Class QAbstractItemView:

virtual QSize viewportSizeHint() const override

Class QAbstractScrollArea:

virtual QSize viewportSizeHint() const

Class QButtonGroup:

void buttonToggled(QAbstractButton *button, bool checked)

Class QFileDialog:

void currentUrlChanged(const QUrl &url)
QUrl directoryUrl() const
void directoryUrlEntered(const QUrl &directory)
QUrl getExistingDirectoryUrl(QWidget *parent, const QString &caption, const QUrl &dir, QFileDialog::Options options, const QStringList &supportedSchemes)
QUrl getOpenFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QStringList &supportedSchemes)
QList<QUrl> getOpenFileUrls(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QStringList &supportedSchemes)
QUrl getSaveFileUrl(QWidget *parent, const QString &caption, const QUrl &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QStringList &supportedSchemes)
QStringList mimeTypeFilters() const
void selectMimeTypeFilter(const QString &filter)
void selectUrl(const QUrl &url)
QList<QUrl> selectedUrls() const
void setDirectoryUrl(const QUrl &directory)
void setMimeTypeFilters(const QStringList &filters)
void urlSelected(const QUrl &url)
void urlsSelected(const QList<QUrl> &urls)

Class QFileIconProvider:

QFileIconProvider::Options options() const
void setOptions(QFileIconProvider::Options options)

Class QHeaderView:

int resizeContentsPrecision() const
void setResizeContentsPrecision(int precision)

Class QInputDialog:

QString getMultiLineText(QWidget *parent, const QString &title, const QString &label, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)

Class QLayout:

QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options)

Class QLineEdit:

void addAction(QAction *action, QLineEdit::ActionPosition position)
QAction *addAction(const QIcon &icon, QLineEdit::ActionPosition position)

Class QListView:

virtual QSize viewportSizeHint() const override

Class QMainWindow:

QWidget *takeCentralWidget()

Class QMenu:

void setAsDockMenu()
NSMenu *toNSMenu()

Class QMenuBar:

NSMenu *toNSMenu()

Class QMessageBox:

QCheckBox *checkBox() const
void setCheckBox(QCheckBox *cb)

Class QSizePolicy:

bool retainSizeWhenHidden() const
void setRetainSizeWhenHidden(bool retainSize)

Class QSplashScreen:

QString message() const

Class QTabBar:

void tabBarClicked(int index)
void tabBarDoubleClicked(int index)

Class QTabWidget:

void tabBarClicked(int index)
void tabBarDoubleClicked(int index)

Class QToolTip:

void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)

Class QTreeView:

void setTreePosition(int index)
int treePosition() const

Class QWidget:

void windowIconChanged(const QIcon &icon)
void windowTitleChanged(const QString &title)

Class QX11Info:

unsigned long getTimestamp()
bool isPlatformX11()

New Functions in Namespaces

QColor colorizationColor(bool *opaqueBlend)
HBITMAP createMask(const QBitmap &bitmap)
void disableBlurBehindWindow(QWidget *window)
void disableBlurBehindWindow(QWindow *window)
void enableBlurBehindWindow(QWidget *window)
void enableBlurBehindWindow(QWidget *window, const QRegion &region)
void enableBlurBehindWindow(QWindow *window)
void enableBlurBehindWindow(QWindow *window, const QRegion &region)
QString errorStringFromHresult(int hresult)
void extendFrameIntoClientArea(QWidget *window, int left, int top, int right, int bottom)
void extendFrameIntoClientArea(QWidget *window, const QMargins &margins)
void extendFrameIntoClientArea(QWindow *window, const QMargins &margins)
void extendFrameIntoClientArea(QWindow *window, int left, int top, int right, int bottom)
QPixmap fromHBITMAP(HBITMAP bitmap, QtWin::HBitmapFormat format)
QPixmap fromHICON(HICON icon)
QRegion fromHRGN(HRGN hrgn)
QImage imageFromHBITMAP(int hdc, HBITMAP bitmap, int width, int height)
bool isCompositionEnabled()
bool isCompositionOpaque()
bool isWindowExcludedFromPeek(QWidget *window)
bool isWindowExcludedFromPeek(QWindow *window)
bool isWindowPeekDisallowed(QWidget *window)
bool isWindowPeekDisallowed(QWindow *window)
void markFullscreenWindow(QWidget *window, bool fullscreen)
void markFullscreenWindow(QWindow *window, bool fullscreen)
QColor realColorizationColor()
void resetExtendedFrame(QWidget *window)
void resetExtendedFrame(QWindow *window)
void setCompositionEnabled(bool enabled)
void setCurrentProcessExplicitAppUserModelID(const QString &id)
void setWindowDisallowPeek(QWidget *window, bool disallow)
void setWindowDisallowPeek(QWindow *window, bool disallow)
void setWindowExcludedFromPeek(QWidget *window, bool exclude)
void setWindowExcludedFromPeek(QWindow *window, bool exclude)
void setWindowFlip3DPolicy(QWidget *window, QtWin::WindowFlip3DPolicy policy)
void setWindowFlip3DPolicy(QWindow *window, QtWin::WindowFlip3DPolicy policy)
QString stringFromHresult(int hresult)
void taskbarActivateTab(QWidget *window)
void taskbarActivateTab(QWindow *window)
void taskbarActivateTabAlt(QWidget *window)
void taskbarActivateTabAlt(QWindow *window)
void taskbarAddTab(QWidget *window)
void taskbarAddTab(QWindow *window)
void taskbarDeleteTab(QWidget *window)
void taskbarDeleteTab(QWindow *window)
HBITMAP toHBITMAP(const QPixmap &p, QtWin::HBitmapFormat format)
HICON toHICON(const QPixmap &p)
HRGN toHRGN(const QRegion &region)
QtWin::WindowFlip3DPolicy windowFlip3DPolicy(QWidget *window)
QtWin::WindowFlip3DPolicy windowFlip3DPolicy(QWindow *window)

New Global Functions

quint64 qFloatDistance(double a, double b)
quint32 qFloatDistance(float a, float b)
quint64 qFloatDistance(double a, double b)
quint32 qFloatDistance(float a, float b)
uint qPopulationCount(quint64 v)
uint qPopulationCount(quint16 v)
uint qPopulationCount(quint32 v)
uint qPopulationCount(quint8 v)
uint qPopulationCount(quint64 v)
uint qPopulationCount(quint16 v)
uint qPopulationCount(quint32 v)
uint qPopulationCount(quint8 v)

New Macros

New Enum Types

enum SizeAdjustPolicy { AdjustIgnored, AdjustToContentsOnFirstShow, AdjustToContents }
enum Base64Option { Base64Encoding, Base64UrlEncoding, KeepTrailingEquals, OmitTrailingEquals, IgnoreBase64DecodingErrors, AbortOnBase64DecodingErrors }
enum Option { DontUseCustomDirectoryIcons }
enum SystemFont { GeneralFont, FixedFont, TitleFont, SmallestReadableFont }
enum ActionPosition { LeadingPosition, TrailingPosition }
enum InputChannelMode { ManagedInputChannel, ForwardedInputChannel }
enum NativeGestureType { BeginNativeGesture, EndNativeGesture, PanNativeGesture, ZoomNativeGesture, SmartZoomNativeGesture, …, SwipeNativeGesture }
enum ScrollPhase { NoScrollPhase, ScrollBegin, ScrollUpdate, ScrollEnd, ScrollMomentum }
enum HBitmapFormat { HBitmapNoAlpha, HBitmapPremultipliedAlpha, HBitmapAlpha }
enum WindowFlip3DPolicy { FlipDefault, FlipExcludeBelow, FlipExcludeAbove }

New Properties

New QML Types

New QML Properties

New QML Signals

New QML Methods

Additions to Other Qt 5 Releases

© 2020 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.