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
地址
Animator
B
BluetoothDiscoveryModel
BluetoothService
BluetoothSocket
BusyIndicator
BusyIndicatorStyle
F
FontDialog
L
定位
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
格式
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 发行的补充