Qt 6.2 中的新类和函数

本页包含 Qt 6.2 中引入的所有新类和函数的综合列表。

新命名空间

(preliminary) namespace QtAndroidPrivate

新类

新成员函数

QAbstractAxis

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

QAbstractProxyModel

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

QAbstractSocket

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

QBarSet

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

QBluetoothDeviceDiscoveryAgent

(since 6.2) void errorOccurred(QBluetoothDeviceDiscoveryAgent::Error error)

班级QBluetoothDeviceInfo

(since 6.2) void setName(const QString &name)

班级QBluetoothLocalDevice

(since 6.2) void errorOccurred(QBluetoothLocalDevice::Error error)

班级QBluetoothServer

(since 6.2) void errorOccurred(QBluetoothServer::Error error)

班级QBluetoothServiceDiscoveryAgent

(since 6.2) void errorOccurred(QBluetoothServiceDiscoveryAgent::Error error)

班级QBluetoothSocket

(since 6.2) void errorOccurred(QBluetoothSocket::SocketError error)

班级QByteArray

(since 6.2) qsizetype lastIndexOf(QByteArrayView bv) const

班级QByteArrayView

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

班级QCanBusDevice

(since 6.2) virtual QCanBusDeviceInfo deviceInfo() const

班级QCanBusDeviceInfo

(since 6.2) QString plugin() const

班级QColorSpace

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

班级QFileInfo

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

班级QFlags

(since 6.2) QFlags<T> fromInt(QFlags<T>::Int i)
(since 6.2) bool operator!=(Enum lhs, QFlags<T> rhs)
(since 6.2) bool operator!=(QFlags<T> lhs, Enum rhs)
(since 6.2) bool operator!=(QFlags<T> lhs, QFlags<T> rhs)
(since 6.2) QFlags<T> operator&(QFlags<T> mask) const
(since 6.2) QFlags<T> &operator&=(QFlags<T> mask)
(since 6.2) bool operator==(Enum lhs, QFlags<T> rhs)
(since 6.2) bool operator==(QFlags<T> lhs, Enum rhs)
(since 6.2) bool operator==(QFlags<T> lhs, QFlags<T> rhs)
(since 6.2) size_t qHash(QFlags<Enum> key, size_t seed)
(since 6.2) bool testAnyFlag(Enum flag) const
(since 6.2) bool testAnyFlags(QFlags<T> flags) const
(since 6.2) bool testFlags(QFlags<T> flags) const
(since 6.2) QFlags<T>::Int toInt() const

班级QGeoAddress

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

班级QGeoAreaMonitorInfo

(since 6.2) QGeoAreaMonitorInfo &operator=(QGeoAreaMonitorInfo &&other)
(since 6.2) void swap(QGeoAreaMonitorInfo &other)

班级QGeoAreaMonitorSource

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

班级QGeoCoordinate

(since 6.2) QGeoCoordinate &operator=(QGeoCoordinate &&other)
(since 6.2) void swap(QGeoCoordinate &other)

班级QGeoLocation

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

班级QGeoPositionInfo

(since 6.2) QGeoPositionInfo &operator=(QGeoPositionInfo &&other)
(since 6.2) void swap(QGeoPositionInfo &other)

班级QGeoSatelliteInfo

(since 6.2) QGeoSatelliteInfo &operator=(QGeoSatelliteInfo &&other)
(since 6.2) void swap(QGeoSatelliteInfo &other)

班级QGeoSatelliteInfoSource

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

班级QGraphicsSceneEvent

(since 6.2) quint64 timestamp() const

班级QGraphicsSceneWheelEvent

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

班级QImage

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

班级QJSEngine

(since 6.2) QJSValue newSymbol(const QString &name)

班级QJniEnvironment

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

班级QJniObject

(since 6.2) QByteArray className() const
(since 6.2) jclass objectClass() const

班级QLatin1StringView

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

班级QLegend

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

班级QLocale

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

QLockFile

(since 6.2) void setStaleLockTime(std::chrono::millisecondsstaleLockTime)
(since 6.2) std::chrono::milliseconds staleLockTimeAsDuration()常量
(since 6.2) bool tryLock(std::chrono::毫秒timeout)

QLowEnergyCharacteristic

(since 6.2) QLowEnergyDescriptor clientCharacteristicConfiguration() const

QLowEnergyController

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

QLowEnergyService

(since 6.2) void errorOccurred(QLowEnergyService::ServiceError newError)

QMetaMethod

(since 6.2) bool isConst() const

QMetaObject

(since 6.2) QMetaType metaType() const

班级QModbusRtuSerialServer

(since 6.2) int interFrameDelay() const
(since 6.2) void setInterFrameDelay(int microseconds)

班级QNativeGestureEvent

(since 6.2) QPointF delta() const
(since 6.2) int fingerCount() const

班级QAndroidApplication

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

班级QNdefFilter

(since 6.2) bool match(const QNdefMessage &message) const

班级QNdefMessage

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

班级QNdefRecord

(since 6.2) void clear()

班级QNearFieldManager

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

班级QNetworkAddressEntry

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

班级QNetworkRequest

(since 6.2) qint64 decompressedSafetyCheckThreshold() const
(since 6.2) void setDecompressedSafetyCheckThreshold(qint64 threshold)

班级QPixmap

(since 6.2) QSizeF deviceIndependentSize() const

班级QQmlContext

(since 6.2) QObject *objectForName(const QString &name) const

班级QQmlListReference

(since 6.2) qsizetype size() const

班级QQuickItemGrabResult

(since 6.2) bool saveToFile(const QUrl &filePath) const

班级QQuickRenderTarget

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

班级QSqlQuery

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

班级QSqlQueryModel

(since 6.2) void setQuery(QSqlQuery &&query)

班级QString

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

班级QStringView

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

班级QTimeZone

(since 6.2) QLocale::Territory territory() const

班级QUntypedBindable

(since 6.2) QMetaType metaType() const

班级QWaylandBufferRef

(since 6.2) bool hasProtectedContent() const

班级QWebEnginePage

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

班级QWebEngineProfile

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

班级QWebEngineView

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

班级QWebSocket

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

班级QWebSocketServer

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

QXYSeries

(since 6.2) QPair<qreal, qreal> 对 bestFitLineEquation(bool&ok) const
(since 6.2) void clearPointConfiguration(const intindex)
(since 6.2) void clearPointConfiguration(const intindex, const QXYSeries::PointConfigurationkey)
(since 6.2) void clearPointsConfiguration()
(since 6.2) void clearPointsConfiguration(const QXYSeries::PointConfigurationkey)
(since 6.2) void colorBy(const QList<qreal>&sourceData, const QLinearGradient&gradient)
(since 6.2) void deselectAllPoints()
(since 6.2) void deselectPoint(intindex)
(since 6.2) void deselectPoints(const QList<int>&indexes)
(since 6.2) bool isPointSelected(intindex)
(since 6.2) const QImage &lightMarker() const
(since 6.2) void lightMarkerChanged(const QImage&lightMarker)
(since 6.2) qreal markerSize()常量
(since 6.2) QHash<QXYSeries::PointConfiguration,QVariant>(QXYSeries::PointConfiguration,QVariant pointConfiguration(const intindex) const
(since 6.2) QXYSeries::PointsConfigurationHash pointsConfiguration()常数
(since 6.2) void selectAllPoints()
(since 6.2) void selectPoint(intindex)
(since 6.2) void selectPoints(const QList<int>&indexes)
(since 6.2) const QImage &selectedLightMarker() const
(since 6.2) QList<int selectedPoints()常量
(since 6.2) void setLightMarker(const QImage&lightMarker)
(since 6.2) void setMarkerSize(qrealsize)
(since 6.2) void setPointConfiguration(const intindex, const QHash<QXYSeries::PointConfiguration, QVariant>&configuration)
(since 6.2) void setPointConfiguration(const intindex, const QXYSeries::PointConfigurationkey, const QVariant&value)
(since 6.2) void setPointSelected(intindex, boolselected)
(since 6.2) void setPointsConfiguration(const QHash<int, QHash<QXYSeries::PointConfiguration, QVariant>>&pointsConfiguration)
(since 6.2) void setSelectedLightMarker(const QImage&selectedLightMarker) (常量 QImage &selectedLightMarker)
(since 6.2) void sizeBy(const QList<qreal>&sourceData, const qrealminSize, const qrealmaxSize)
(since 6.2) void toggleSelection(const QList<int>&indexes)

命名空间中的新函数

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

新全局函数

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

新宏

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

新枚举类型

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

新枚举值

新属性

新变量

(since 6.2) CCCDDisable
(since 6.2) CCCDEnableIndication
(since 6.2) CCCDEnableNotification

新 QML 类型

新 QML 属性

QML 类型ColorGroup

(since 6.2) placeholderText : color

QML 类型Image

(since 6.2) mirrorVertically : bool

QML 类型SystemPalette

(since 6.2) placeholderText : color

QML 类型TableView

(since 6.2) selectionModel : ItemSelectionModel

QML 类型Texture

(since 6.2) autoOrientation : bool

新的 QML 方法

QML 类型Locale

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

QML 类型TableView

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

QML 类型View3D

(since 6.2) List<pickResult> pickAll(float x, float y)
(since 6.2) pickResult rayPick(vector3d origin, vector3d direction)
(since 6.2) List<pickResult> rayPickAll(vector3d origin, vector3d direction)

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.