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 :

operator= (QDir && other )

類 QFileInfo :

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

類 QProcess :

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

類 QBitArray :

operator= (QBitArray && other )

類 QByteArray :

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

類 QCommandLineOption :

operator= (QCommandLineOption && other )

類 QContiguousCache :

operator= (QContiguousCache<T> && other )

類 QDateTime :

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

類 QEasingCurve :

operator= (QEasingCurve && other )

類 QExplicitlySharedDataPointer :

operator= (QExplicitlySharedDataPointer<T> && other )

類 QHash :

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

類 QJsonValue :

toInt (int defaultValue ) const

類 QLinkedList :

operator= (QLinkedList<T> && other )

類 QList :

operator= (QList<T> && other )

類 QMap :

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

類 QMetaType :

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

類 QMimeType :

operator= (QMimeType && other )

類 QObject :

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

類 QPair :

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

類 QPersistentModelIndex :

operator= (QPersistentModelIndex && other )

類 QRegExp :

operator= (QRegExp && other )

類 QSharedDataPointer :

operator= (QSharedDataPointer<T> && other )

類 QString :

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

類 QStringRef :

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

類 QThread :

isInterruptionRequested () const
requestInterruption ()

類 QThreadPool :

clear ()

類 QUrl :

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

類 QUrlQuery :

operator= (QUrlQuery && other )

類 QVariant :

operator= (QVariant && other )

類 QVector :

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

類 QCursor :

operator= (QCursor && other )

類 QGuiApplication :

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

類 QIcon :

operator= (QIcon && other )

類 QImage :

operator= (QImage && other )

類 QKeySequence :

operator= (QKeySequence && other )

類 QNativeGestureEvent :

gestureType () const
globalPos () const
localPos () const
pos () const
screenPos () const
value () const
windowPos () const

類 QBrush :

operator= (QBrush && other )

類 QColor :

name (QColor::NameFormat format ) const

類 QPainterPath :

operator= (QPainterPath && other )

類 QPalette :

operator= (QPalette && other )

類 QPen :

operator= (QPen && other )

類 QPicture :

operator= (QPicture && other )

類 QPixmap :

operator= (QPixmap && other )

類 QRegion :

operator= (QRegion && other )

類 QTouchDevice :

maximumTouchPoints () const

類 QVector2D :

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

類 QVector4D :

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

類 QVector3D :

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

類 QWheelEvent :

phase () const

類 QAbstractTextDocumentLayout :

unregisterHandler (int objectType , QObject * component )

類 QFontDatabase :

systemFont (QFontDatabase::SystemFont type )

類 QFont :

operator= (QFont && other )

類 QFontMetrics :

operator= (QFontMetrics && other )

類 QPlatformFontDatabase :

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

類 QPlatformIntegration :

virtual createEventDispatcher () const = 0
virtual createPlatformSessionManager (const QString & id , const QString & key ) const
virtual sync ()

類 QPlatformTheme :

virtual keyBindings (QKeySequence::StandardKey key ) const

類 QNetworkAccessManager :

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

類 QNetworkConfiguration :

bearerTypeFamily () const

類 QSslConfiguration :

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

類 QQuickWindow :

resetOpenGLState ()

類 QPressureReading :

setTemperature (qreal temperature )

類 QSerialPort :

handle () const

類 QAbstractItemView :

virtual viewportSizeHint () const override

類 QAbstractScrollArea :

virtual viewportSizeHint () const

類 QButtonGroup :

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

類 QFileDialog :

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

類 QFileIconProvider :

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

類 QHeaderView :

resizeContentsPrecision () const
setResizeContentsPrecision (int precision )

類 QInputDialog :

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

類 QLayout :

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

類 QLineEdit :

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

類 QListView :

virtual viewportSizeHint () const override

類 QMainWindow :

takeCentralWidget ()

類 QMenu :

setAsDockMenu ()
toNSMenu ()

類 QMenuBar :

toNSMenu ()

類 QMessageBox :

checkBox () const
setCheckBox (QCheckBox * cb )

類 QSizePolicy :

retainSizeWhenHidden () const
setRetainSizeWhenHidden (bool retainSize )

類 QSplashScreen :

message () const

類 QTabBar :

tabBarClicked (int index )
tabBarDoubleClicked (int index )

類 QTabWidget :

tabBarClicked (int index )
tabBarDoubleClicked (int index )

類 QToolTip :

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

類 QTreeView :

setTreePosition (int index )
treePosition () const

類 QWidget :

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

類 QX11Info :

getTimestamp ()
isPlatformX11 ()

名稱空間中的新函數

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

新全局函數

qFloatDistance (double a , double b )
qFloatDistance (float a , float b )
qPopulationCount (quint8 v )
qPopulationCount (quint64 v )
qPopulationCount (quint32 v )
qPopulationCount (quint16 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, AdjustToContentsOnFirstShow, AdjustToContents }
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, ScrollMomentum }
enum HBitmapFormat { HBitmapNoAlpha, HBitmapPremultipliedAlpha, HBitmapAlpha }
enum WindowFlip3DPolicy { FlipDefault, FlipExcludeBelow, FlipExcludeAbove }

新特性

新 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 ()
linkHovered ()
editingFinished ()

新 QML 方法

acceptProposedAction ()
getDataAsString ()
matches ()
append ()

其它 Qt 5 發行的補充