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.

新名稱空間

namespace QBluetooth
namespace QtMac

新類

A
QAndroidJniEnvironment
QAndroidJniObject
QAssociativeIterable
Alternative ( QBluetoothServiceInfo )
B
QBluetoothAddress
QBluetoothDeviceDiscoveryAgent
QBluetoothDeviceInfo
QBluetoothHostInfo
QBluetoothLocalDevice
QBluetoothServer
QBluetoothServiceDiscoveryAgent
QBluetoothServiceInfo
QBluetoothSocket
QBluetoothTransferManager
QBluetoothTransferReply
QBluetoothTransferRequest
QBluetoothUuid
C
const_iterator ( QAssociativeIterable )
QCollator
QCollatorSortKey
QCommandLineOption
QCommandLineParser
const_iterator ( QSequentialIterable )
F
QFileSelector
G
QGeoAddress
QGeoAreaMonitorInfo
QGeoAreaMonitorSource
QGeoCircle
QGeoCoordinate
QGeoLocation
QGeoPositionInfo
QGeoPositionInfoSource
QGeoPositionInfoSourceFactory
QGeoRectangle
QGeoSatelliteInfo
QGeoSatelliteInfoSource
QGeoShape
K
QKeySequenceEdit
L
QLoggingCategory
M
QMacPasteboardMime
N
QNativeGestureEvent
QNdefFilter
QNdefNfcTextRecord
QNdefNfcUriRecord
QNdefRecord
QNearFieldManager
QNearFieldTarget
QNmeaPositionInfoSource
O
QOpenGLTexture
Q
QQmlFileSelector
QQmlNdefRecord
QQuickFramebufferObject
R
Renderer ( QQuickFramebufferObject )
S
Sequence ( QBluetoothServiceInfo )
QSequentialIterable
QStaticPlugin
T
QTimeZone
W
QWinJumpList
QWinJumpListCategory
QWinJumpListItem
QWinTaskbarButton
QWinTaskbarProgress
QWinThumbnailToolBar
QWinThumbnailToolButton

新成員函數

類 QDir :

QDir & operator= (QDir && other )

類 QFileInfo :

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

類 QProcess :

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

類 QUrlQuery :

QUrlQuery & operator= (QUrlQuery && other )

類 QUrl :

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

類 QPersistentModelIndex :

QPersistentModelIndex & operator= (QPersistentModelIndex && other )

類 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 ()
bool hasRegisteredConverterFunction (int fromTypeId , int toTypeId )
bool hasRegisteredDebugStreamOperator ()
bool hasRegisteredDebugStreamOperator (int typeId )
bool registerComparators ()
bool registerConverter ()
bool registerConverter (MemberFunction function )
bool registerConverter (MemberFunctionOk function )
bool registerConverter (UnaryFunction function )

類 QObject :

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

類 QVariant :

QVariant & operator= (QVariant && other )

類 QMimeType :

QMimeType & operator= (QMimeType && other )

類 QThread :

bool isInterruptionRequested () const
void requestInterruption ()

類 QThreadPool :

void clear ()

類 QBitArray :

QBitArray & operator= (QBitArray && other )

類 QByteArray :

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

類 QCommandLineOption :

QCommandLineOption & operator= (QCommandLineOption && other )

類 QContiguousCache :

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

類 QEasingCurve :

QEasingCurve & operator= (QEasingCurve && other )

類 QDateTime :

QDateTime fromMSecsSinceEpoch (qint64 msecs , Qt::TimeSpec spec , int offsetSeconds = 0)
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

類 QHash :

QHash & operator= (QHash && other )

類 QLinkedList :

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

類 QList :

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

類 QPair :

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

類 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 )

類 QRegExp :

QRegExp & operator= (QRegExp && other )

類 QSharedDataPointer :

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

類 QExplicitlySharedDataPointer :

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

類 QString :

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

類 QStringRef :

QStringRef left (int n ) const
QStringRef mid (int position , int n = -1) const
QStringRef right (int n ) const

類 QVector :

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

類 QIcon :

QIcon & operator= (QIcon && other )

類 QImage :

QImage & operator= (QImage && other )

類 QPicture :

QPicture & operator= (QPicture && other )

類 QPixmap :

QPixmap & operator= (QPixmap && other )

類 QCursor :

QCursor & operator= (QCursor && other )

類 QGuiApplication :

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

類 QWheelEvent :

Qt::ScrollPhase phase () const

類 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

類 QKeySequence :

QKeySequence & operator= (QKeySequence && other )

類 QPalette :

QPalette & operator= (QPalette && other )

類 QPlatformIntegration :

virtual QAbstractEventDispatcher * createEventDispatcher () const = 0
virtual QPlatformSessionManager * createPlatformSessionManager (const QString & id , const QString & key ) const
virtual void sync ()

類 QPlatformTheme :

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

類 QTouchDevice :

int maximumTouchPoints () const

類 QVector3D :

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

類 QVector2D :

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

類 QVector4D :

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

類 QColor :

QString name (NameFormat format ) const

類 QBrush :

QBrush & operator= (QBrush && other )

類 QPainterPath :

QPainterPath & operator= (QPainterPath && other )

類 QPen :

QPen & operator= (QPen && other )

類 QRegion :

QRegion & operator= (QRegion && other )

類 QAbstractTextDocumentLayout :

void unregisterHandler (int objectType , QObject * component = Q_NULLPTR)

類 QFontDatabase :

QFont systemFont (SystemFont type )

類 QFont :

QFont & operator= (QFont && other )

類 QFontMetrics :

QFontMetrics & operator= (QFontMetrics && other )

類 QPlatformFontDatabase :

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

類 QNetworkAccessManager :

void connectToHost (const QString & hostName , quint16 port = 80)
void connectToHostEncrypted (const QString & hostName , quint16 port = 443, const QSslConfiguration & sslConfiguration = QSslConfiguration::defaultConfiguration())
QStringList supportedSchemes () const
QStringList supportedSchemesImplementation () const

類 QNetworkConfiguration :

BearerType bearerTypeFamily () const

類 QSslConfiguration :

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

類 QFileDialog :

void currentUrlChanged (const QUrl & url )
QUrl directoryUrl () const
void directoryUrlEntered (const QUrl & directory )
QUrl getExistingDirectoryUrl (QWidget * parent = Q_NULLPTR, const QString & caption = QString(), const QUrl & dir = QUrl(), Options options = ShowDirsOnly, const QStringList & supportedSchemes = QStringList())
QUrl getOpenFileUrl (QWidget * parent = Q_NULLPTR, const QString & caption = QString(), const QUrl & dir = QUrl(), const QString & filter = QString(), QString * selectedFilter = Q_NULLPTR, Options options = Options(), const QStringList & supportedSchemes = QStringList())
QList<QUrl> getOpenFileUrls (QWidget * parent = Q_NULLPTR, const QString & caption = QString(), const QUrl & dir = QUrl(), const QString & filter = QString(), QString * selectedFilter = Q_NULLPTR, Options options = Options(), const QStringList & supportedSchemes = QStringList())
QUrl getSaveFileUrl (QWidget * parent = Q_NULLPTR, const QString & caption = QString(), const QUrl & dir = QUrl(), const QString & filter = QString(), QString * selectedFilter = Q_NULLPTR, Options options = Options(), const QStringList & supportedSchemes = QStringList())
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 )

類 QInputDialog :

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

類 QMessageBox :

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

類 QAbstractItemView :

virtual QSize viewportSizeHint () const

類 QFileIconProvider :

選項 options () const
void setOptions (Options options )

類 QHeaderView :

int resizeContentsPrecision () const
void setResizeContentsPrecision (int precision )

類 QListView :

virtual QSize viewportSizeHint () const

類 QTreeView :

void setTreePosition (int index )
int treePosition () const

類 QLayout :

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

類 QSizePolicy :

bool retainSizeWhenHidden () const
void setRetainSizeWhenHidden (bool retainSize )

類 QToolTip :

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

類 QWidget :

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

類 QAbstractScrollArea :

virtual QSize viewportSizeHint () const

類 QButtonGroup :

void buttonToggled (QAbstractButton * button , bool checked )
void buttonToggled (int id , bool checked )

類 QLineEdit :

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

類 QMainWindow :

QWidget * takeCentralWidget ()

類 QMenu :

void setAsDockMenu ()
NSMenu * toNSMenu ()

類 QMenuBar :

NSMenu * toNSMenu ()

類 QSplashScreen :

QString message () const

類 QTabBar :

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

類 QTabWidget :

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

類 QQuickWindow :

void resetOpenGLState ()

類 QSerialPort :

Handle handle () const

類 QPressureReading :

void setTemperature (qreal temperature )

類 QX11Info :

unsigned long getTimestamp ()
bool isPlatformX11 ()

名稱空間中的新函數

QColor colorizationColor (bool * opaqueBlend = Q_NULLPTR)
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 (HRESULT 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 , HBitmapFormat format = HBitmapNoAlpha)
QPixmap fromHICON (HICON icon )
QRegion fromHRGN (HRGN hrgn )
QImage imageFromHBITMAP (HDC 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 = true)
void markFullscreenWindow (QWindow * window , bool fullscreen = true)
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 , WindowFlip3DPolicy policy )
void setWindowFlip3DPolicy (QWindow * window , WindowFlip3DPolicy policy )
QString stringFromHresult (HRESULT 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 , HBitmapFormat format = HBitmapNoAlpha)
HICON toHICON (const QPixmap & p )
HRGN toHRGN (const QRegion & region )
WindowFlip3DPolicy windowFlip3DPolicy (QWidget * window )
WindowFlip3DPolicy windowFlip3DPolicy (QWindow * window )

新全局函數

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

新宏

Q_DECLARE_LOGGING_CATEGORY ( name )
Q_FORWARD_DECLARE_CF_TYPE ( type )
Q_FORWARD_DECLARE_MUTABLE_CF_TYPE ( type )
Q_FORWARD_DECLARE_OBJC_CLASS ( classname )
Q_LOGGING_CATEGORY ( name , string )
qCCritical ( category )
qCDebug ( category )
qCWarning ( category )

新枚舉類型

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

新特性

新 QML 類型

A
Address
Animator
B
BluetoothDiscoveryModel
BluetoothService
BluetoothSocket
BusyIndicator
BusyIndicatorStyle
F
FontDialog
L
Location
M
MessageDialog
N
NdefFilter
NdefMimeRecord
NdefTextRecord
NdefUriRecord
NearField
O
OpacityAnimator
P
Position
PositionSource
Q
QtPositioning
R
RotationAnimator
S
ScaleAnimator
SpinBoxStyle
StatusBarStyle
Switch
SwitchStyle
T
TextAreaStyle
ToolBarStyle
U
UniformAnimator
X
XAnimator
Y
YAnimator

新 QML 特性

colorData
dragType
formats
hasColor
hasHtml
hasText
hasUrls
hoveredLink
hoveredLink
html
mimeData
pixelDensity
proposedAction
showFiles
showHidden
text
urls

新 QML 信號

linkHovered (string link )
linkHovered (string link )
editingFinished ()

新 QML 方法

acceptProposedAction ()
string getDataAsString (string format )
bool matches (StandardKey key )
void append (string text )

其它 Qt 5 發行的補充