Qt 6.2 中的新类和函数

This page contains a comprehensive list of all new classes and functions introduced in Qt 6.2.

新名称空间

(preliminary) namespace QtAndroidPrivate

新类

A
QAndroidActivityResultReceiver
QAndroidApplication ( QNativeInterface )
QAndroidBinder
QAndroidIntent
QAndroidParcel
QAndroidService
QAndroidServiceConnection
C
QColorAxis
H
QHashSeed
M
QModbusRtuSerialClient
QModbusRtuSerialServer
N
QNmeaSatelliteInfoSource
Q
QQuick3DInstancing
R
QRgbaFloat
S
SystemId ( QCalendar )
W
QWebEngineContextMenuRequest
QWebEngineHistoryModel
QWebEngineLoadingInfo
QWebEngineNavigationRequest
QWebEngineNewWindowRequest
X
QX11Application ( QNativeInterface )

新成员函数

QAbstractAxis :

(从 6.2 起) void labelsTruncatedChanged (bool labelsTruncated )
(从 6.2 起) void truncateLabelsChanged (bool truncateLabels )

QAbstractProxyModel :

(从 6.2 起) QModelIndex createSourceIndex (int row , int col , void * internalPtr ) const

QAbstractSocket :

(从 6.2 起) bool bind (QHostAddress::SpecialAddress addr , quint16 port , QAbstractSocket::BindMode mode )

QBarSet :

(从 6.2 起) void deselectAllBars ()
(从 6.2 起) void deselectBar (int index )
(从 6.2 起) void deselectBars (const QList<int> & indexes )
(从 6.2 起) bool isBarSelected (int index ) const
(从 6.2 起) void selectAllBars ()
(从 6.2 起) void selectBar (int index )
(从 6.2 起) void selectBars (const QList<int> & indexes )
(从 6.2 起) QList<int> selectedBars () const
(从 6.2 起) QColor selectedColor () const
(从 6.2 起) void setBarSelected (int index , bool selected )
(从 6.2 起) void setSelectedColor (const QColor & color )
(从 6.2 起) void toggleSelection (const QList<int> & indexes )

QBluetoothDeviceDiscoveryAgent :

(从 6.2 起) void errorOccurred (QBluetoothDeviceDiscoveryAgent::Error error )

QBluetoothDeviceInfo :

(从 6.2 起) void setName (const QString & name )

QBluetoothLocalDevice :

(从 6.2 起) void errorOccurred (QBluetoothLocalDevice::Error error )

QBluetoothServer :

(从 6.2 起) void errorOccurred (QBluetoothServer::Error error )

QBluetoothServiceDiscoveryAgent :

(从 6.2 起) void errorOccurred (QBluetoothServiceDiscoveryAgent::Error error )

QBluetoothSocket :

(从 6.2 起) void errorOccurred (QBluetoothSocket::SocketError error )

QByteArray :

(从 6.2 起) qsizetype lastIndexOf (QByteArrayView bv ) const

QByteArrayView :

(从 6.2 起) int compare (QByteArrayView bv , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (QByteArrayView bv ) const

QCanBusDevice :

(从 6.2 起) virtual QCanBusDeviceInfo deviceInfo () const

QCanBusDeviceInfo :

(从 6.2 起) QString plugin () const

QColorSpace :

(从 6.2 起) QString description () const
(从 6.2 起) void setDescription (const QString & description )

QFileInfo :

(从 6.2 起) std::filesystem::path filesystemJunctionTarget () const
(从 6.2 起) QString junctionTarget () const

QFlags :

(从 6.2 起) QFlags<T> fromInt (QFlags<T>::Int i )
(从 6.2 起) QFlags<T> operator& (QFlags<T> other ) const
(从 6.2 起) QFlags<T> & operator&= (QFlags<T> mask )
(从 6.2 起) size_t qHash (QFlags<Enum> flags , size_t seed )
(从 6.2 起) bool testAnyFlag (Enum flag ) const
(从 6.2 起) bool testAnyFlags (QFlags<T> flags ) const
(从 6.2 起) bool testFlags (QFlags<T> flags ) const
(从 6.2 起) QFlags<T>::Int toInt () const

QGeoAddress :

(从 6.2 起) QGeoAddress & operator= (QGeoAddress & other )
(从 6.2 起) void setStreetNumber (const QString & streetNumber )
(从 6.2 起) QString streetNumber () const

QGeoAreaMonitorInfo :

(从 6.2 起) QGeoAreaMonitorInfo & operator= (QGeoAreaMonitorInfo && other )

QGeoAreaMonitorSource :

(从 6.2 起) virtual QVariant backendProperty (const QString & name ) const
(从 6.2 起) virtual bool setBackendProperty (const QString & name , const QVariant & value )

QGeoCoordinate :

(从 6.2 起) QGeoCoordinate & operator= (QGeoCoordinate && other )

QGeoLocation :

(从 6.2 起) QGeoShape boundingShape () const
(从 6.2 起) QGeoLocation & operator= (QGeoLocation && other )
(从 6.2 起) void setBoundingShape (const QGeoShape & boundingShape )

QGeoPositionInfo :

(从 6.2 起) QGeoPositionInfo & operator= (QGeoPositionInfo && other )

QGeoSatelliteInfo :

(从 6.2 起) QGeoSatelliteInfo & operator= (QGeoSatelliteInfo && other )

QGeoSatelliteInfoSource :

(从 6.2 起) virtual QVariant backendProperty (const QString & name ) const
(从 6.2 起) virtual bool setBackendProperty (const QString & name , const QVariant & value )

QGraphicsSceneEvent :

(从 6.2 起) quint64 timestamp () const

QGraphicsSceneWheelEvent :

(从 6.2 起) bool isInverted () const
(从 6.2 起) Qt::ScrollPhase phase () const
(从 6.2 起) QPoint pixelDelta () const

QImage :

(从 6.2 起) QSizeF deviceIndependentSize () const
(从 6.2 起) QImage fromData (QByteArrayView data , const char * format )
(从 6.2 起) bool loadFromData (QByteArrayView data , const char * format )

QJSEngine :

(从 6.2 起) QJSValue newSymbol (const QString & name )

QJniEnvironment :

(从 6.2 起) jfieldID findField (jclass clazz , const char * fieldName , const char * signature )
(从 6.2 起) jmethodID findMethod (jclass clazz , const char * methodName , const char * signature )
(从 6.2 起) jfieldID findStaticField (jclass clazz , const char * fieldName , const char * signature )
(从 6.2 起) jmethodID findStaticMethod (jclass clazz , const char * methodName , const char * signature )
(从 6.2 起) bool isValid () const

QJniObject :

(从 6.2 起) QByteArray className () const
(从 6.2 起) jclass objectClass () const

QLatin1StringView :

(从 6.2 起) qsizetype lastIndexOf (QStringView str , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (QLatin1StringView l1 , Qt::CaseSensitivity cs ) const

QLegend :

(从 6.2 起) void attachedToChartChanged (bool attached )
(从 6.2 起) bool isInteractive () const
(从 6.2 起) void setInteractive (bool interactive )

QLocale :

(从 6.2 起) QLocale::Territory codeToTerritory (QStringView territoryCode )
(从 6.2 起) QString nativeTerritoryName () const
(从 6.2 起) QLocale::Territory territory () const
(从 6.2 起) QString territoryToCode (QLocale::Territory territory )
(从 6.2 起) QString territoryToString (QLocale::Territory territory )

QLockFile :

(从 6.2 起) void setStaleLockTime (std::chrono::milliseconds staleLockTime )
(从 6.2 起) std::chrono::milliseconds staleLockTimeAsDuration () const
(从 6.2 起) bool tryLock (std::chrono::milliseconds timeout )

QLowEnergyCharacteristic :

(从 6.2 起) QLowEnergyDescriptor clientCharacteristicConfiguration () const

QLowEnergyController :

(从 6.2 起) QLowEnergyController * createPeripheral (const QBluetoothAddress & localDevice , QObject * parent )
(从 6.2 起) void errorOccurred (QLowEnergyController::Error newError )
(从 6.2 起) int mtu () const

QLowEnergyService :

(从 6.2 起) void errorOccurred (QLowEnergyService::ServiceError newError )

QMetaMethod :

(从 6.2 起) bool isConst () const

QMetaObject :

(从 6.2 起) QMetaType metaType () const

QModbusRtuSerialServer :

(从 6.2 起) int interFrameDelay () const
(从 6.2 起) void setInterFrameDelay (int microseconds )

QNativeGestureEvent :

(从 6.2 起) QPointF delta () const
(从 6.2 起) int fingerCount () const

QAndroidApplication :

(从 6.2 起) QJniObject context ()
(从 6.2 起) void hideSplashScreen (int duration )
(从 6.2 起) bool isActivityContext ()
(从 6.2 起) QFuture<QVariant> runOnAndroidMainThread (const std::function<QVariant ()> & runnable , const QDeadlineTimer timeout )
(从 6.2 起) int sdkVersion ()

QNdefFilter :

(从 6.2 起) bool match (const QNdefMessage & message ) const

QNdefMessage :

(从 6.2 起) QNdefMessage & operator= (const QNdefMessage & other )
(从 6.2 起) QNdefMessage & operator= (QNdefMessage && other )

QNdefRecord :

(从 6.2 起) void clear ()

QNearFieldManager :

(从 6.2 起) bool isEnabled () const
(从 6.2 起) void setUserInformation (const QString & message )
(从 6.2 起) void targetDetectionStopped ()

QNetworkCacheMetaData :

(从 6.2 起) QDebug operator<< (QDebug debug , const QNetworkAddressEntry & entry )

QNetworkRequest :

(从 6.2 起) qint64 decompressedSafetyCheckThreshold () const
(从 6.2 起) void setDecompressedSafetyCheckThreshold (qint64 threshold )

QPixmap :

(从 6.2 起) QSizeF deviceIndependentSize () const

QQmlContext :

(从 6.2 起) QObject * objectForName (const QString & name ) const

QQmlListReference :

(从 6.2 起) qsizetype size () const

QQuickItemGrabResult :

(从 6.2 起) bool saveToFile (const QUrl & filePath ) const

QQuickRenderTarget :

(从 6.2 起) QQuickRenderTarget fromOpenGLRenderBuffer (uint renderbufferId , const QSize & pixelSize , int sampleCount )

QSqlQuery :

(从 6.2 起) QSqlQuery & operator= (QSqlQuery && other )
(从 6.2 起) void swap (QSqlQuery & other )

QSqlQueryModel :

(从 6.2 起) void setQuery (QSqlQuery && query )

QString :

(从 6.2 起) qsizetype lastIndexOf (QLatin1StringView str , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (const QString & str , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (QStringView str , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (const QRegularExpression & re , QRegularExpressionMatch * rmatch ) const

QStringView :

(从 6.2 起) qsizetype lastIndexOf (QStringView str , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (QLatin1StringView l1 , Qt::CaseSensitivity cs ) const
(从 6.2 起) qsizetype lastIndexOf (const QRegularExpression & re , QRegularExpressionMatch * rmatch ) const

QTimeZone :

(从 6.2 起) QLocale::Territory territory () const

QUntypedBindable :

(从 6.2 起) QMetaType metaType () const

QWaylandBufferRef :

(从 6.2 起) bool hasProtectedContent () const

QWebEnginePage :

(从 6.2 起) void loadingChanged (const QWebEngineLoadingInfo & loadingInfo )
(从 6.2 起) void navigationRequested (QWebEngineNavigationRequest & request )
(从 6.2 起) void newWindowRequested (QWebEngineNewWindowRequest & request )

QWebEngineProfile :

(从 6.2 起) void requestIconForIconURL (const QUrl & url , int desiredSizeInPixel , std::function<void (const QIcon &, const QUrl &)> iconAvailableCallback ) const
(从 6.2 起) void requestIconForPageURL (const QUrl & url , int desiredSizeInPixel , std::function<void (const QIcon &, const QUrl &, const QUrl &)> iconAvailableCallback ) const

QWebEngineView :

(从 6.2 起) QWebEngineView * forPage (const QWebEnginePage * page )
(从 6.2 起) QWebEngineContextMenuRequest * lastContextMenuRequest () const
(从 6.2 起) void pdfPrintingFinished (const QString & filePath , bool success )
(从 6.2 起) void print (QPrinter * printer )
(从 6.2 起) void printFinished (bool success )
(从 6.2 起) void printRequested ()
(从 6.2 起) void printToPdf (const QString & filePath , const QPageLayout & layout , const QPageRanges & ranges )
(从 6.2 起) void printToPdf (const std::function<void (const QByteArray &)> & resultCallback , const QPageLayout & layout , const QPageRanges & ranges )

QWebSocket :

(从 6.2 起) void alertReceived (QSsl::AlertLevel level , QSsl::AlertType type , const QString & description )
(从 6.2 起) void alertSent (QSsl::AlertLevel level , QSsl::AlertType type , const QString & description )
(从 6.2 起) void continueInterruptedHandshake ()
(从 6.2 起) void handshakeInterruptedOnError (const QSslError & error )
(从 6.2 起) void peerVerifyError (const QSslError & error )

QWebSocketServer :

(从 6.2 起) void alertReceived (QSsl::AlertLevel level , QSsl::AlertType type , const QString & description )
(从 6.2 起) void alertSent (QSsl::AlertLevel level , QSsl::AlertType type , const QString & description )
(从 6.2 起) void handshakeInterruptedOnError (const QSslError & error )

QXYSeries :

(从 6.2 起) QPair<qreal, qreal> bestFitLineEquation (bool & ok ) const
(从 6.2 起) void clearPointConfiguration (const int index )
(从 6.2 起) void clearPointConfiguration (const int index , const QXYSeries::PointConfiguration key )
(从 6.2 起) void clearPointsConfiguration ()
(从 6.2 起) void clearPointsConfiguration (const QXYSeries::PointConfiguration key )
(从 6.2 起) void colorBy (const QList<qreal> & sourceData , const QLinearGradient & gradient )
(从 6.2 起) void deselectAllPoints ()
(从 6.2 起) void deselectPoint (int index )
(从 6.2 起) void deselectPoints (const QList<int> & indexes )
(从 6.2 起) bool isPointSelected (int index )
(从 6.2 起) const QImage & lightMarker () const
(从 6.2 起) void lightMarkerChanged (const QImage & lightMarker )
(从 6.2 起) qreal markerSize () const
(从 6.2 起) QHash<QXYSeries::PointConfiguration, QVariant> pointConfiguration (const int index ) const
(从 6.2 起) QHash<int, QHash<QXYSeries::PointConfiguration, QVariant>> pointsConfiguration () const
(从 6.2 起) void selectAllPoints ()
(从 6.2 起) void selectPoint (int index )
(从 6.2 起) void selectPoints (const QList<int> & indexes )
(从 6.2 起) const QImage & selectedLightMarker () const
(从 6.2 起) QList<int> selectedPoints () const
(从 6.2 起) void setLightMarker (const QImage & lightMarker )
(从 6.2 起) void setMarkerSize (qreal size )
(从 6.2 起) void setPointConfiguration (const int index , const QHash<QXYSeries::PointConfiguration, QVariant> & configuration )
(从 6.2 起) void setPointConfiguration (const int index , const QXYSeries::PointConfiguration key , const QVariant & value )
(从 6.2 起) void setPointSelected (int index , bool selected )
(从 6.2 起) void setPointsConfiguration (const QHash<int, QHash<QXYSeries::PointConfiguration, QVariant>> & pointsConfiguration )
(从 6.2 起) void setSelectedLightMarker (const QImage & selectedLightMarker )
(从 6.2 起) void sizeBy (const QList<qreal> & sourceData , const qreal minSize , const qreal maxSize )
(从 6.2 起) void toggleSelection (const QList<int> & indexes )

名称空间中的新函数

(从 6.2 起) void beginPropertyUpdateGroup ()
(从 6.2 起) bool bindService (const QAndroidIntent & serviceIntent , const QAndroidServiceConnection & serviceConnection , QtAndroidPrivate::BindFlags flags )
(preliminary) QFuture<QtAndroidPrivate::PermissionResult> checkPermission (const QString & permission )
(从 6.2 起) void endPropertyUpdateGroup ()
(preliminary) QFuture<QtAndroidPrivate::PermissionResult> requestPermission (const QString & permission )
(从 6.2 起) void startActivity (const QJniObject & intent , int receiverRequestCode , std::function<void (int, int, const QJniObject &)> callbackFunc )
(从 6.2 起) void startActivity (const QAndroidIntent & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver )
(从 6.2 起) void startActivity (const QJniObject & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver )
(从 6.2 起) void startIntentSender (const QJniObject & intentSender , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver )

新全局函数

(从 6.2 起) std::underlying_type_t<Enum> qToUnderlying (Enum e )
(从 6.2 起) const char * qWebEngineChromiumVersion ()
(从 6.2 起) const char * qWebEngineVersion ()

新宏

(从 6.2 起) PRIXQUINTPTR
(从 6.2 起) PRIdQINTPTR
(从 6.2 起) PRIdQPTRDIFF
(从 6.2 起) PRIdQSIZETYPE
(从 6.2 起) PRIiQINTPTR
(从 6.2 起) PRIiQPTRDIFF
(从 6.2 起) PRIiQSIZETYPE
(从 6.2 起) PRIoQUINTPTR
(从 6.2 起) PRIuQUINTPTR
(从 6.2 起) PRIxQUINTPTR
(从 6.2 起) Q_IMPORT_QML_PLUGIN ( PluginName )

新枚举类型

(从 6.2 起) enum RubberBand { NoRubberBand, VerticalRubberBand, HorizontalRubberBand, RectangleRubberBand, ClickThroughRubberBand }
(从 6.2 起) enum SocketOption { NoOptions, AbstractNamespaceOption }
(从 6.2 起) enum DiscoveryMode { FullDiscovery, SkipValueDiscovery }
(从 6.2 起) enum EditFlag { CanUndo, CanRedo, CanCut, CanCopy, CanPaste, …, CanEditRichly }
(从 6.2 起) enum MediaFlag { MediaInError, MediaPaused, MediaMuted, MediaLoop, MediaCanSave, …, MediaCanRotate }
(从 6.2 起) enum MediaType { MediaTypeNone, MediaTypeImage, MediaTypeVideo, MediaTypeAudio, MediaTypeCanvas, …, MediaTypePlugin }
(从 6.2 起) enum class PointConfiguration { Color, Size, Visibility, LabelVisibility, LabelFormat }
(从 6.2 起) enum class BindFlag { None, AutoCreate, DebugUnbind, NotForeground, AboveClient, …, ExternalService }

New Enum Values

enum value Country::AnyTerritory
enum value Country::NauruTerritory
enum value Country::TokelauTerritory
enum value Country::TuvaluTerritory
enum value Error::LocationServiceTurnedOffError
enum value Error::UpdateTimeoutError
enum value Format::Format_RGBA16FPx4
enum value Format::Format_RGBA16FPx4_Premultiplied
enum value Format::Format_RGBA32FPx4
enum value Format::Format_RGBA32FPx4_Premultiplied
enum value Format::Format_RGBX16FPx4
enum value Format::Format_RGBX32FPx4
enum value PixelMetric::PM_LineEditIconSize
enum value SpecialCharacter::VisualTabCharacter

新特性

新的变量

(从 6.2 起) CCCDDisable
(从 6.2 起) CCCDEnableIndication
(从 6.2 起) CCCDEnableNotification

新 QML 类型

A
Affector3D
Attractor3D
D
Dialog
Direction3D
E
EmitBurst3D
F
FileDialog
FileInstancing
FontDialog
G
Gravity3D
I
InstanceListEntry
InstanceRange
Instancing
M
ModelParticle3D
P
Particle3D
ParticleAbstractShape3D
ParticleEmitter3D
ParticleModelShape3D
ParticleShape3D
ParticleSystem3D
ParticleSystem3DLogging
PointRotator3D
R
RandomInstancing
RuntimeLoader
S
SelectionRectangle
SpriteParticle3D
SpriteSequence3D
StandardPaths
T
TargetDirection3D
TrailEmitter3D
V
VectorDirection3D
W
Wander3D

新 QML 特性

QML 类型 ColorGroup :

(从 6.2 起) placeholderText : color

QML 类型 Image :

(从 6.2 起) mirrorVertically : bool

QML 类型 SystemPalette :

(从 6.2 起) placeholderText : color

QML 类型 TableView :

(从 6.2 起) selectionModel : ItemSelectionModel

QML 类型 Texture :

(从 6.2 起) autoOrientation : bool

新 QML 方法

QML 类型 Locale :

(从 6.2 起) string formattedDataSize (int bytes , int precision , DataSizeFormat format )

QML 类型 TableView :

(从 6.2 起) real columnWidth (int column )
(从 6.2 起) real implicitColumnWidth (int column )
(从 6.2 起) real implicitRowHeight (int row )
(从 6.2 起) bool isColumnLoaded (int column )
(从 6.2 起) bool isRowLoaded (int row )
(从 6.2 起) real rowHeight (int row )

QML 类型 View3D :

(从 6.2 起) List<PickResult> pickAll (float x , float y )
(从 6.2 起) PickResult rayPick (vector3d origin , vector3d direction )
(从 6.2 起) List<PickResult> rayPickAll (vector3d origin , vector3d direction )