Qt 5.1 中的新类和函数

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

新类

A
QAbstractOpenGLFunctions
QAccelerometer
QAccelerometerFilter
QAccelerometerReading
QAltimeter
QAltimeterFilter
QAltimeterReading
QAmbientLightFilter
QAmbientLightReading
QAmbientLightSensor
QAmbientTemperatureFilter
QAmbientTemperatureReading
QAmbientTemperatureSensor
B
Binder ( QOpenGLVertexArrayObject )
C
QCompass
QCompassFilter
QCompassReading
D
QDBusVirtualObject
QDebugStateSaver
G
QGlobalStatic
QGyroscope
QGyroscopeFilter
QGyroscopeReading
H
QHolsterFilter
QHolsterReading
QHolsterSensor
I
QIRProximityFilter
QIRProximityReading
QIRProximitySensor
L
QLightFilter
QLightReading
QLightSensor
QLockFile
M
QMagnetometer
QMagnetometerFilter
QMagnetometerReading
QMessageAuthenticationCode
O
QOffscreenSurface
QOpenGLDebugLogger
QOpenGLDebugMessage
QOpenGLFunctions_1_0
QOpenGLFunctions_1_1
QOpenGLFunctions_1_2
QOpenGLFunctions_1_3
QOpenGLFunctions_1_4
QOpenGLFunctions_1_5
QOpenGLFunctions_2_0
QOpenGLFunctions_2_1
QOpenGLFunctions_3_0
QOpenGLFunctions_3_1
QOpenGLFunctions_3_2_Compatibility
QOpenGLFunctions_3_2_Core
QOpenGLFunctions_3_3_Compatibility
QOpenGLFunctions_3_3_Core
QOpenGLFunctions_4_0_Compatibility
QOpenGLFunctions_4_0_Core
QOpenGLFunctions_4_1_Compatibility
QOpenGLFunctions_4_1_Core
QOpenGLFunctions_4_2_Compatibility
QOpenGLFunctions_4_2_Core
QOpenGLFunctions_4_3_Compatibility
QOpenGLFunctions_4_3_Core
QOpenGLFunctions_ES2
QOpenGLTimeMonitor
QOpenGLTimerQuery
QOpenGLVersionProfile
QOpenGLVertexArrayObject
QOrientationFilter
QOrientationReading
QOrientationSensor
qoutputrange
P
QPressureFilter
QPressureReading
QPressureSensor
QProximityFilter
QProximityReading
QProximitySensor
Q
QQmlApplicationEngine
QQuickTextDocument
R
QRegularExpressionValidator
QRotationFilter
QRotationReading
QRotationSensor
S
QSaveFile
QSensor
QSensorBackend
QSensorChangesInterface
QSensorGesture
QSensorGestureManager
QSensorGesturePluginInterface
QSensorGestureRecognizer
QSensorPluginInterface
QSerialPort
QSerialPortInfo
T
QTapFilter
QTapReading
QTapSensor
QTiltFilter
QTiltReading
QTiltSensor
X
QX11Info

新成员函数

QAbstractFileEngine :

virtual renameOverwrite (const QString & newName )
virtual syncToDisk ()

QProcess :

setArguments (const QStringList & arguments )
setProgram (const QString & program )
start (QIODevice::OpenMode mode )

QChar :

script (uint ucs4 )
script () const

QJsonDocument :

toJson (QJsonDocument::JsonFormat format ) const

QLocale :

toDouble (const QStringRef & s , bool * ok ) const
toFloat (const QStringRef & s , bool * ok ) const
toInt (const QStringRef & s , bool * ok ) const
toLongLong (const QStringRef & s , bool * ok ) const
toShort (const QStringRef & s , bool * ok ) const
toUInt (const QStringRef & s , bool * ok ) const
toULongLong (const QStringRef & s , bool * ok ) const
toUShort (const QStringRef & s , bool * ok ) const

QMap :

insert (QMap::const_iterator pos , const Key & key , const T & value )
insertMulti (QMap::const_iterator pos , const Key & key , const T & value )

QMargins :

operator*= (int factor )
operator*= (qreal factor )
operator+= (const QMargins & margins )
operator-= (const QMargins & margins )
operator/= (int divisor )
operator/= (qreal divisor )

QMetaMethod :

revision () const

QMetaProperty :

revision () const

QMultiMap :

insert (typename QMap<Key, T>::const_iterator pos , const Key & key , const T & value )

QPoint :

dotProduct (const QPoint & p1 , const QPoint & p2 )

QPointF :

dotProduct (const QPointF & p1 , const QPointF & p2 )

QRect :

marginsAdded (const QMargins & margins ) const
marginsRemoved (const QMargins & margins ) const
operator+= (const QMargins & margins )
operator-= (const QMargins & margins )

QRegularExpression :

namedCaptureGroups () const

QSharedPointer :

create (Args &&... args )

QString :

contains (const QRegularExpression & re , QRegularExpressionMatch * match ) const

QStringRef :

toDouble (bool * ok ) const
toFloat (bool * ok ) const
toInt (bool * ok , int base ) const
toLong (bool * ok , int base ) const
toLongLong (bool * ok , int base ) const
toShort (bool * ok , int base ) const
toUInt (bool * ok , int base ) const
toULong (bool * ok , int base ) const
toULongLong (bool * ok , int base ) const
toUShort (bool * ok , int base ) const
trimmed () const

QUrl :

fromStringList (const QStringList & urls , QUrl::ParsingMode mode )
toStringList (const QList<QUrl> & urls , QUrl::FormattingOptions options )

QVarLengthArray :

squeeze ()

QVector :

removeFirst ()
removeLast ()
takeFirst ()
takeLast ()

QIcon :

actualSize (QWindow * window , const QSize & size , QIcon::Mode mode , QIcon::State state ) const
pixmap (QWindow * window , const QSize & size , QIcon::Mode mode , QIcon::State state ) const

QInputMethod :

inputItemRectangle () const
setInputItemRectangle (const QRectF & rect )

QKeySequence :

listFromString (const QString & str , QKeySequence::SequenceFormat format )
listToString (const QList<QKeySequence> & list , QKeySequence::SequenceFormat format )

QVector2D :

distanceToLine (const QVector2D & point , const QVector2D & direction ) const
distanceToPoint (const QVector2D & point ) const

QVector3D :

distanceToPoint (const QVector3D & point ) const

QWindow :

alert (int msec )

QRawFont :

advancesForGlyphIndexes (const QVector<quint32> & glyphIndexes , QRawFont::LayoutFlags layoutFlags ) const
advancesForGlyphIndexes (const quint32 * glyphIndexes , QPointF * advances , int numGlyphs , QRawFont::LayoutFlags layoutFlags ) const

QPlatformFontDatabase :

writingSystemsFromTrueTypeBits (quint32 [4] unicodeRange , quint32 [2] codePageRange )

QPlatformTheme :

virtual createIconEngine (const QString & iconName ) const

QPlatformWindow :

virtual isAlertState () const
virtual setAlertState (bool enable )

QLocalSocket :

connectToServer (QIODevice::OpenMode openMode )
setServerName (const QString & name )

QNetworkAccessManager :

encrypted (QNetworkReply * reply )

QNetworkReply :

encrypted ()

QSslConfiguration :

localCertificateChain () const
setLocalCertificateChain (const QList<QSslCertificate> & localChain )

QSslSocket :

localCertificateChain () const
setLocalCertificateChain (const QList<QSslCertificate> & localChain )

QQmlExtensionPlugin :

baseUrl () const

QQuickItem :

forceActiveFocus (Qt::FocusReason reason )

QQuickWindow :

closing (QQuickCloseEvent * close )
hasDefaultAlphaBuffer ()
setDefaultAlphaBuffer (bool useAlpha )

QAccelerometer :

accelerationModeChanged (QAccelerometer::AccelerationMode accelerationMode )
setAccelerationMode (QAccelerometer::AccelerationMode accelerationMode )

QLightSensor :

setFieldOfView (qreal fieldOfView )

QRotationSensor :

setHasZ (bool hasZ )

QSensor :

setCurrentOrientation (int currentOrientation )
setEfficientBufferSize (int efficientBufferSize )
setMaxBufferSize (int maxBufferSize )
setSkipDuplicates (bool skipDuplicates )
skipDuplicatesChanged (bool skipDuplicates )

QSqlRecord :

keyValues (const QSqlRecord & keyFields ) const

QSqlTableModel :

primaryValues (int row ) const

QGraphicsView :

rubberBandChanged (QRect rubberBandRect , QPointF fromScenePoint , QPointF toScenePoint )
rubberBandRect () const

QMenu :

addSection (const QIcon & icon , const QString & text )
addSection (const QString & text )
insertSection (QAction * before , const QIcon & icon , const QString & text )
insertSection (QAction * before , const QString & text )

新全局函数

operator* (qreal factor , const QMargins & margins )
operator* (int factor , const QMargins & margins )
operator* (const QMargins & margins , qreal factor )
operator* (const QMargins & margins , int factor )
operator+ (const QRect & rectangle , const QMargins & margins )
operator+ (const QMargins & margins , const QRect & rectangle )
operator+ (const QMargins & m1 , const QMargins & m2 )
operator- (const QMargins & margins )
operator- (const QMargins & m1 , const QMargins & m2 )
operator/ (const QMargins & margins , qreal divisor )
operator/ (const QMargins & margins , int divisor )
qDegreesToRadians (float degrees )
qDegreesToRadians (double degrees )
qEnvironmentVariableIsEmpty (const char * varName )
qEnvironmentVariableIsSet (const char * varName )
qRadiansToDegrees (float radians )
qRadiansToDegrees (double radians )
qunsetenv (const char * varName )

新宏

Q_COREAPP_STARTUP_FUNCTION (QtStartUpFunction ptr )
Q_GLOBAL_STATIC ( Type , VariableName )
Q_GLOBAL_STATIC_WITH_ARGS ( Type , VariableName , 自变量 )

新枚举类型

enum AccelerationMode { Combined, Gravity, User }
enum Script { Script_Unknown, Script_Inherited, Script_Common, Script_Latin, ..., ScriptCount }
enum JsonFormat { Indented, Compact }
enum LayoutFlag { SeparateAdvances, KernedAdvances, UseDesignMetrics }
enum AxesOrientationMode { FixedOrientation, AutomaticOrientation, UserOrientation }
enum Visibility { Hidden, AutomaticVisibility, Windowed, Minimized, Maximized, FullScreen }
enum ApplicationState { ApplicationSuspended, ApplicationHidden, ApplicationInactive, ApplicationActive }
enum Edge { TopEdge, LeftEdge, RightEdge, BottomEdge }

新的 Typedef

typedef qoutputrangelist
typedef qrange
typedef qrangelist

新特性

新 QML 类型

A
ApplicationWindow
B
Button
ButtonStyle
C
CheckBox
CheckBoxStyle
CloseEvent
ColorDialog
ComboBox
ComboBoxStyle
F
FileDialog
G
GroupBox
GroupBoxStyle
L
Label
M
Menu
MenuBar
P
ProgressBar
ProgressBarStyle
R
RadioButton
RadioButtonStyle
S
ScrollView
ScrollViewStyle
Slider
SliderStyle
SpinBox
SplitView
StackView
StackViewDelegate
StatusBar
T
Tab
TabView
TabViewStyle
TableView
TableViewColumn
TableViewStyle
TextArea
TextField
TextFieldStyle
ToolBar
ToolButton

新 QML 特性

active
activeFocusItem
application
contentOrientation
desktopAvailableHeight
desktopAvailableWidth
(obsolete) logicalPixelDensity
maximumHeight
maximumWidth
minimumHeight
minimumWidth
name
opacity
platform
selectByKeyboard
textDocument
visibility

新 QML 信号

closing ()

新 QML 方法

forceLayout ()
forceActiveFocus ()
nextItemInFocusChain ()
forceLayout ()
alert ()
requestActivate ()

其它 Qt 5 发行的补充