Qt 6.1 中的新类和函数

此页面包含 Qt 6.1 引入的所有新类和函数的综合列表。Qt 6 之前发行的新 API 链接在此页面底部可找到。

新类

J
QJniEnvironment
QJniObject
QJSManagedValue
QJSPrimitiveNull
QJSPrimitiveUndefined
QJSPrimitiveValue
N
QNetworkInformation

新成员函数

QByteArray :

QByteArray::iterator erase (QByteArray::const_iterator first , QByteArray::const_iterator last )
qsizetype erase (QByteArray & ba , const T & t )
qsizetype erase_if (QByteArray & ba , Predicate pred )
QByteArray & removeIf (Predicate pred )

QFuture :

QFuture<T> onCanceled (QObject * context , Function && handler )
QFuture<T> onFailed (QObject * context , Function && handler )
QFuture<ResultType<Function> > then (QObject * context , Function && function )

QHash :

qsizetype erase_if (QHash<Key, T> & hash , Predicate pred )
qsizetype removeIf (Predicate pred )

QList :

qsizetype erase (QList<T> & list , const AT & t )
qsizetype erase_if (QList<T> & list , Predicate pred )
qsizetype removeIf (Predicate pred )

QLocale :

QLocale::Language codeToLanguage (QStringView languageCode )
QLocale::Script codeToScript (QStringView scriptCode )
QString languageToCode (QLocale::Language 语言 )
QString scriptToCode (QLocale::Script script )

QMap :

qsizetype erase_if (QMap<Key, T> & map , Predicate pred )
QMap::size_type removeIf (Predicate pred )

QMetaType :

bool hasRegisteredDataStreamOperators () const

QMultiHash :

qsizetype erase_if (QMultiHash<Key, T> & hash , Predicate pred )
qsizetype removeIf (Predicate pred )

QMultiMap :

qsizetype erase_if (QMultiMap<Key, T> & map , Predicate pred )
QMultiMap::size_type removeIf (Predicate pred )

QOperatingSystemVersion :

QVersionNumber version () const

QSet :

qsizetype erase_if (QSet<T> & set , Predicate pred )
QSet::iterator insert (QSet::const_iterator it , const T & value )

QSocketNotifier :

bool isValid () const
void setSocket (qintptr socket )

QString :

QString::iterator erase (QString::const_iterator first , QString::const_iterator last )
qsizetype erase (QString & s , const T & t )
qsizetype erase_if (QString & s , Predicate pred )
QString fromUtf8 (const char8_t * str )
QString & removeIf (Predicate pred )

QStringView :

QStringView::const_iterator constBegin () const
QStringView::const_iterator constEnd () const
bool contains (const QRegularExpression & re , QRegularExpressionMatch * rmatch ) const
qsizetype count (const QRegularExpression & re ) const
qsizetype indexOf (const QRegularExpression & re , qsizetype from , QRegularExpressionMatch * rmatch ) const
qsizetype lastIndexOf (const QRegularExpression & re , qsizetype from , QRegularExpressionMatch * rmatch ) const

QUntypedBindable :

bool isReadOnly () const
QUntypedPropertyBinding takeBinding ()

QVarLengthArray :

qsizetype erase (QVarLengthArray<T, Prealloc> & array , const AT & t )
qsizetype erase_if (QVarLengthArray<T, Prealloc> & array , Predicate pred )
qsizetype removeAll (const AT & t )
qsizetype removeIf (Predicate pred )
bool removeOne (const AT & t )

QColorSpace :

void setTransferFunction (const QList<uint16_t> & transferFunctionTable )
void setTransferFunctions (const QList<uint16_t> & redTransferFunctionTable , const QList<uint16_t> & greenTransferFunctionTable , const QList<uint16_t> & blueTransferFunctionTable )
QColorSpace withTransferFunction (const QList<uint16_t> & transferFunctionTable ) const
QColorSpace withTransferFunctions (const QList<uint16_t> & redTransferFunctionTable , const QList<uint16_t> & greenTransferFunctionTable , const QList<uint16_t> & blueTransferFunctionTable ) const

QTextDocument :

QTextDocument::ResourceProvider defaultResourceProvider ()
QTextDocument::ResourceProvider resourceProvider () const
void setDefaultResourceProvider (const QTextDocument::ResourceProvider & provider )
void setResourceProvider (const QTextDocument::ResourceProvider & provider )

QNetworkCookie :

QNetworkCookie::SameSite sameSitePolicy () const
void setSameSitePolicy (QNetworkCookie::SameSite sameSite )

QSslSocket :

QString activeBackend ()
QList<QString> availableBackends ()
QList<QSsl::ImplementedClass> implementedClasses (const QString & backendName )
bool isClassImplemented (QSsl::ImplementedClass cl , const QString & backendName )
bool isFeatureSupported (QSsl::SupportedFeature ft , const QString & backendName )
bool isProtocolSupported (QSsl::SslProtocol protocol , const QString & backendName )
bool setActiveBackend (const QString & backendName )
QList<QSsl::SupportedFeature> supportedFeatures (const QString & backendName )
QList<QSsl::SslProtocol> supportedProtocols (const QString & backendName )

QJSEngine :

void throwError (const QJSValue & error )

QJSPrimitiveValue :

bool operator!= (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
QJSPrimitiveValue operator* (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
QJSPrimitiveValue operator+ (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
QJSPrimitiveValue operator- (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
QJSPrimitiveValue operator/ (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
bool operator< (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
bool operator<= (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
bool operator== (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
bool operator> (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )
bool operator>= (const QJSPrimitiveValue & lhs , const QJSPrimitiveValue & rhs )

QQmlPropertyMap :

void freeze ()
void insert (const QVariantHash & )

QSGOpenGLTexture :

QSGTexture * fromNativeExternalOES (GLuint textureId , QQuickWindow * window , const QSize & size , QQuickWindow::CreateTextureOptions options )

QQuickGraphicsConfiguration :

QByteArrayList preferredInstanceExtensions ()

QLabel :

QTextDocument::ResourceProvider resourceProvider () const
void setResourceProvider (const QTextDocument::ResourceProvider & provider )

QLayout :

void unsetContentsMargins ()

QStyle :

QString name () const

名称空间中的新函数

QFuture<T> makeExceptionalFuture (std::exception_ptr exception )
QFuture<T> makeExceptionalFuture (const QException & exception )
QFuture<T> makeReadyFuture (const QList<T> & )
QFuture<void> makeReadyFuture ()
QFuture<std::decay_t<T> > makeReadyFuture (T && value )

新全局函数

typename std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> qAddOverflow (T v1 , T v2 , T * result )
auto qHypot (Tx x , Ty y , Tz z )
auto qHypot (Tx x , Ty y )
auto qHypot (F first , Fs... rest )
typename std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> qMulOverflow (T v1 , T v2 , T * result )
typename std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> qSubOverflow (T v1 , T v2 , T * result )

新枚举类型

enum class SameSite { Default, None, Lax, Strict }
enum class ImplementedClass { Key, Certificate, Socket, DiffieHellman, EllipticCurve, …, DtlsCookie }
enum class SupportedFeature { CertificateVerification, ClientSideAlpn, ServerSideAlpn, Ocsp, Psk, …, Alerts }

新类型别名

  ResourceProvider

新特性

新的变量

  Android10
  Android11
  AndroidOreo_MR1
  AndroidPie

其它 Qt 6 发行的补充