类型转换

Qt 的许多基本数据类型,如QStringQPointQImage ,都提供了与本地等价类型之间的转换。

下面列举了所有可用的类型转换:

QByteArray::fromCFData()

QByteArray::fromEcmaUint8Array()

QByteArray::fromNSData()

构造一个新的 QByteArray,其中包含 NSData 数据的副本

QByteArray::fromRawCFData()

构造一个使用 CFData 数据字节的 QByteArray

QByteArray::fromRawNSData()

构造一个使用 NSData 数据字节的 QByteArray

QDateTime::fromCFDate()

构造一个新的 QDateTime,其中包含 CFDate 日期的副本

QDateTime::fromNSDate()

构造一个新的 QDateTime,其中包含 NSDate 日期的副本

QImage::fromHBITMAP()

返回与给定 hbitmap 相对应的 QImage

QImage::fromHICON()

返回与给定图标等价的 QImage

QPointF::fromCGPoint()

从 CGPoint 点创建 QRectF

QRectF::fromCGRect()

从 CGRect rect 创建 QRectF

QRectF::fromDOMRect()

QSizeF::fromCGSize()

根据大小创建 QSizeF

QString::fromCFString()

构造一个新的 QString,其中包含 CFString 字符串的副本

QString::fromEcmaString()

QString::fromNSString()

构造一个新的 QString,包含字符串 NSString 的副本

QTimeZone::fromCFTimeZone()

构造一个新的 QTimeZone,包含 CFTimeZone timeZone 的副本

QTimeZone::fromNSTimeZone()

构造一个新的 QTimeZone,包含 NSTimeZone timeZone 的副本

QUrl::fromCFURL()

创建一个 QUrl,其中包含 CFURL url 的副本

QUrl::fromNSURL()

构造一个 QUrl,其中包含 NSURL url 的副本

QUuid::fromCFUUID()

创建一个新 QUuid,其中包含 uuid CFUUID 的副本

QUuid::fromNSUUID()

构造一个新 QUuid,其中包含 uuid NSUUID 的副本

QByteArray::toEcmaUint8Array()

QByteArray::toCFData()

从 QByteArray 创建 CFData

QByteArray::toRawCFData()

使用 QByteArray 的字节构造 CFData

QDateTime::toCFDate()

从 QDateTime 创建 CFDate

QStringView::toCFString()

从该 QStringView 创建 CFString

QString::toCFString()

从 QString 创建 CFString

QTimeZone::toCFTimeZone()

从 QTimeZone 创建 CFTimeZone

QUrl::toCFURL()

从 QUrl 创建 CFURL

QUuid::toCFUUID()

从 QUuid 创建 CFUUID

QImage::toCGImage()

QPointF::toCGPoint()

从 QPointF 创建 CGPoint

QPoint::toCGPoint()

从 QPointF 创建 CGPoint

QRectF::toCGRect()

从 QRectF 创建 CGRect

QRect::toCGRect()

从 QRectF 创建 CGRect

QSizeF::toCGSize()

从 QSizeF 创建 CGSize

QSize::toCGSize()

从 QSize 创建 CGSize

QImage::toHBITMAP()

创建与 QImage 相对应的 HBITMAP

QImage::toHICON()

创建相当于 QPixmap 的 HICON,应用掩码遮罩

QByteArray::toNSData()

从 QByteArray 创建 NSData

QByteArray::toRawNSData()

使用 QByteArray 的字节创建 NSData

QDateTime::toNSDate()

从 QDateTime 创建 NSDate

QString::toNSString()

从 QString 创建 NSString

QStringView::toNSString()

从该 QStringView 创建一个 NSString

QTimeZone::toNSTimeZone()

从 QTimeZone 创建 NSTimeZone

QUrl::toNSURL()

从 QUrl 创建 NSURL

QUuid::toNSUUID()

从 QUuid 创建 NSUUID

QRectF::toDOMRect()

QString::toEcmaString()

© 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.