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 :

void labelsTruncatedChanged (bool labelsTruncated )
void truncateLabelsChanged (bool truncateLabels )

QAbstractProxyModel :

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

QAbstractSocket :

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

QBarSet :

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

QBluetoothDeviceDiscoveryAgent :

void errorOccurred (QBluetoothDeviceDiscoveryAgent::Error error )

QBluetoothDeviceInfo :

void setName (const QString & name )

QBluetoothLocalDevice :

void errorOccurred (QBluetoothLocalDevice::Error error )

QBluetoothServer :

void errorOccurred (QBluetoothServer::Error error )

QBluetoothServiceDiscoveryAgent :

void errorOccurred (QBluetoothServiceDiscoveryAgent::Error error )

QBluetoothSocket :

void errorOccurred (QBluetoothSocket::SocketError error )

QByteArray :

qsizetype lastIndexOf (QByteArrayView bv ) const

QByteArrayView :

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

QCanBusDevice :

virtual QCanBusDeviceInfo deviceInfo () const

QCanBusDeviceInfo :

QString plugin () const

QColorSpace :

QString description () const
void setDescription (const QString & description )

QFileInfo :

std::filesystem::path filesystemJunctionTarget () const
QString junctionTarget () const

QFlags :

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

QGeoAddress :

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

QGeoAreaMonitorInfo :

QGeoAreaMonitorInfo & operator= (QGeoAreaMonitorInfo && other )

QGeoAreaMonitorSource :

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

QGeoCoordinate :

QGeoCoordinate & operator= (QGeoCoordinate && other )

QGeoLocation :

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

QGeoPositionInfo :

QGeoPositionInfo & operator= (QGeoPositionInfo && other )

QGeoSatelliteInfo :

QGeoSatelliteInfo & operator= (QGeoSatelliteInfo && other )

QGeoSatelliteInfoSource :

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

QGraphicsSceneEvent :

quint64 timestamp () const

QGraphicsSceneWheelEvent :

bool isInverted () const
Qt::ScrollPhase phase () const
QPoint pixelDelta () const

QImage :

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

QJSEngine :

QJSValue newSymbol (const QString & name )

QJniEnvironment :

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

QJniObject :

QByteArray className () const
jclass objectClass () const

QLatin1StringView :

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

QLegend :

void attachedToChartChanged (bool attached )
bool isInteractive () const
void setInteractive (bool interactive )

QLocale :

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

QLockFile :

void setStaleLockTime (std::chrono::milliseconds value )
std::chrono::milliseconds staleLockTimeAsDuration () const
bool tryLock (std::chrono::milliseconds timeout )

QLowEnergyCharacteristic :

QLowEnergyDescriptor clientCharacteristicConfiguration () const

QLowEnergyController :

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

QLowEnergyService :

void errorOccurred (QLowEnergyService::ServiceError newError )

QMetaMethod :

bool isConst () const

QMetaObject :

QMetaType metaType () const

QModbusRtuSerialServer :

int interFrameDelay () const
void setInterFrameDelay (int microseconds )

QNativeGestureEvent :

QPointF delta () const
int fingerCount () const

QAndroidApplication :

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

QNdefFilter :

bool match (const QNdefMessage & message ) const

QNdefMessage :

QNdefMessage & operator= (const QNdefMessage & other )
QNdefMessage & operator= (QNdefMessage && other )

QNdefRecord :

void clear ()

QNearFieldManager :

bool isEnabled () const
void setUserInformation (const QString & message )
void targetDetectionStopped ()

QNetworkAddressEntry :

QDebug operator<< (QDebug debug , const QNetworkAddressEntry & entry )

QNetworkRequest :

qint64 decompressedSafetyCheckThreshold () const
void setDecompressedSafetyCheckThreshold (qint64 threshold )

QPixmap :

QSizeF deviceIndependentSize () const

QQmlContext :

QObject * objectForName (const QString & name ) const

QQmlListReference :

qsizetype size () const

QQuickItemGrabResult :

bool saveToFile (const QUrl & filePath ) const

QQuickRenderTarget :

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

QSqlQuery :

QSqlQuery & operator= (QSqlQuery && other )
void swap (QSqlQuery & other )

QSqlQueryModel :

void setQuery (QSqlQuery && query )

QString :

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

QStringView :

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

QTimeZone :

QLocale::Territory territory () const

QUntypedBindable :

QMetaType metaType () const

QWaylandBufferRef :

bool hasProtectedContent () const

QWebEnginePage :

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

QWebEngineProfile :

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

QWebEngineView :

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

QWebSocket :

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

QWebSocketServer :

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

QXYSeries :

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

名称空间中的新函数

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

新全局函数

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

新宏

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

新枚举类型

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

新特性

新的变量

CCCDDisable
CCCDEnableIndication
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 :

placeholderText : color

QML 类型 Image :

mirrorVertically : bool

QML 类型 SystemPalette :

placeholderText : color

QML 类型 TableView :

selectionModel : ItemSelectionModel

QML 类型 Texture :

autoOrientation : bool

新 QML 方法

QML 类型 Locale :

string formattedDataSize (int bytes , int precision , DataSizeFormat format )

QML 类型 TableView :

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

QML 类型 View3D :

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