Obsolete Members for QVariant
クラスQVariant の以下のメンバーは非推奨です。これらは古いソース・コードの動作を維持するために提供されています。新しいコードでは使用しないことを強くお勧めします。
パブリック型
(deprecated) enum | Type { Invalid, BitArray, Bitmap, Bool, Brush, …, UserType } |
パブリック関数
(deprecated in 6.0) | QVariant(QVariant::Type type) |
(deprecated in 6.0) bool | canConvert(int targetTypeId) const |
(deprecated in 6.0) bool | convert(int targetTypeId) |
(deprecated in 6.0) QVariant::Type | type() const |
静的パブリック・メンバ
(deprecated in 6.0) QVariant::Type | nameToType(const char *name) |
(deprecated in 6.0) const char * | typeToName(int typeId) |
関連する非メンバー
(deprecated in 6.0) QDataStream & | operator<<(QDataStream &s, const QVariant::Type p) |
(deprecated in 6.0) QDataStream & | operator>>(QDataStream &s, QVariant::Type &p) |
メンバー型ドキュメント
[deprecated]
enum QVariant::Type
この列挙型は非推奨である。新しいコードでは使用しないことを強くお勧めします。
代わりにQMetaType::Type 。
この列挙型は、QVariant が含むことができる変数の型を定義します。
定数 | 値 | 説明 |
---|---|---|
QVariant::Invalid | QMetaType::UnknownType | 型なし |
QVariant::BitArray | QMetaType::QBitArray | aQBitArray |
QVariant::Bitmap | QMetaType::QBitmap | aQBitmap |
QVariant::Bool | QMetaType::Bool | ブール |
QVariant::Brush | QMetaType::QBrush | aQBrush |
QVariant::ByteArray | QMetaType::QByteArray | aQByteArray |
QVariant::Char | QMetaType::QChar | aQChar |
QVariant::Color | QMetaType::QColor | aQColor |
QVariant::Cursor | QMetaType::QCursor | aQCursor |
QVariant::Date | QMetaType::QDate | aQDate |
QVariant::DateTime | QMetaType::QDateTime | aQDateTime |
QVariant::Double | QMetaType::Double | 倍 |
QVariant::EasingCurve | QMetaType::QEasingCurve | aQEasingCurve |
QVariant::Uuid | QMetaType::QUuid | aQUuid |
QVariant::ModelIndex | QMetaType::QModelIndex | aQModelIndex |
QVariant::PersistentModelIndex (since Qt 5.5) | QMetaType::QPersistentModelIndex | aQPersistentModelIndex |
QVariant::Font | QMetaType::QFont | aQFont |
QVariant::Hash | QMetaType::QVariantHash | aQVariantHash |
QVariant::Icon | QMetaType::QIcon | aQIcon |
QVariant::Image | QMetaType::QImage | aQImage |
QVariant::Int | QMetaType::Int | an int |
QVariant::KeySequence | QMetaType::QKeySequence | aQKeySequence |
QVariant::Line | QMetaType::QLine | aQLine |
QVariant::LineF | QMetaType::QLineF | aQLineF |
QVariant::List | QMetaType::QVariantList | aQVariantList |
QVariant::Locale | QMetaType::QLocale | aQLocale |
QVariant::LongLong | QMetaType::LongLong | aqlonglong |
QVariant::Map | QMetaType::QVariantMap | aQVariantMap |
QVariant::Transform | QMetaType::QTransform | aQTransform |
QVariant::Matrix4x4 | QMetaType::QMatrix4x4 | aQMatrix4x4 |
QVariant::Palette | QMetaType::QPalette | aQPalette |
QVariant::Pen | QMetaType::QPen | aQPen |
QVariant::Pixmap | QMetaType::QPixmap | aQPixmap |
QVariant::Point | QMetaType::QPoint | aQPoint |
QVariant::PointF | QMetaType::QPointF | aQPointF |
QVariant::Polygon | QMetaType::QPolygon | aQPolygon |
QVariant::PolygonF | QMetaType::QPolygonF | aQPolygonF |
QVariant::Quaternion | QMetaType::QQuaternion | aQQuaternion |
QVariant::Rect | QMetaType::QRect | aQRect |
QVariant::RectF | QMetaType::QRectF | aQRectF |
QVariant::RegularExpression | QMetaType::QRegularExpression | aQRegularExpression |
QVariant::Region | QMetaType::QRegion | aQRegion |
QVariant::Size | QMetaType::QSize | aQSize |
QVariant::SizeF | QMetaType::QSizeF | aQSizeF |
QVariant::SizePolicy | QMetaType::QSizePolicy | aQSizePolicy |
QVariant::String | QMetaType::QString | aQString |
QVariant::StringList | QMetaType::QStringList | aQStringList |
QVariant::TextFormat | QMetaType::QTextFormat | aQTextFormat |
QVariant::TextLength | QMetaType::QTextLength | aQTextLength |
QVariant::Time | QMetaType::QTime | aQTime |
QVariant::UInt | QMetaType::UInt | auint |
QVariant::ULongLong | QMetaType::ULongLong | aqulonglong |
QVariant::Url | QMetaType::QUrl | aQUrl |
QVariant::Vector2D | QMetaType::QVector2D | aQVector2D |
QVariant::Vector3D | QMetaType::QVector3D | aQVector3D |
QVariant::Vector4D | QMetaType::QVector4D | aQVector4D |
QVariant::UserType | QMetaType::User | ユーザー定義型の基本値。 |
メンバ関数ドキュメント
[explicit, deprecated in 6.0]
QVariant::QVariant(QVariant::Type type)
この関数は6.0から非推奨となった。新しいコードでは使わないことを強くお勧めします。
代わりにQMetaType を取るコンストラクタを使用してください。
type 型の初期化されていないバリアントを構築します。これは特別な null 状態のバリアントを作成し、アクセスされた場合はtype のデフォルト値を返します。
isNull()も参照してください 。
[deprecated in 6.0]
bool QVariant::canConvert(int targetTypeId) const
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
これはオーバーロードされた関数です。
代わりにcanConvert(QMetaType(targetTypeId))
を使用してください。
QMetaType::canConvert()も参照 。
[deprecated in 6.0]
bool QVariant::convert(int targetTypeId)
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにconvert(QMetaType(targetTypeId))
を使ってください。
要求された型に variant をキャストします。targetTypeId 。キャストができなかった場合、バリアントは要求された型に変更されますが、QVariant(Type) で構築されたのと同じようなクリアされた null 状態になります。
バリアントの現在の型が正常にキャストされた場合はtrue
を返し、そうでない場合はfalse
を返します。
QObject から派生した型へのポインタを含むQVariant も、targetTypeId で記述された型へのqobject_cast が成功する場合は変換され、この関数に対して真を返します。これはQ_OBJECT マクロを使用するQObject サブクラスに対してのみ機能することに注意してください。
注意: 初期化されていなかったり、以前の変換に失敗したために NULL となっている QVariants の変換は常に失敗し、型が変更され、NULL のままとなり、false
を返します。
canConvert() およびclear()も参照してください 。
[static, deprecated in 6.0]
QVariant::Type QVariant::nameToType(const char *name)
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにQMetaType::fromName(name).id()
を使用してください。
name で与えられたストレージ型の文字列表現を列挙型表現に変換します。
文字列表現がどの列挙型表現にも変換できない場合、バリアントはInvalid
に設定されます。
[deprecated in 6.0]
QVariant::Type QVariant::type() const
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強く推奨する。
代わりにtypeId() かmetaType() を使ってください。
バリアントに格納されている値の格納タイプを返します。この関数はQVariant::Type を返すと宣言されていますが、返り値はQMetaType::Type と解釈されるべきです。特に、QVariant::UserType は、値がQMetaType::User と等しいか大きい場合にのみ返されます。
QVariant::Char ~ QVariant::RegExp およびQVariant::Font ~QVariant::Transform の範囲の戻り値は、QMetaType::QChar ~QMetaType::QRegularExpression およびQMetaType::QFont ~QMetaType::QQuaternion の範囲の値に対応することに注意してください。
charとQChar のバリアントを扱うときは特に注意してください。char型専用のコンストラクタはQVariant にはありませんが、QChar にはあることに注意してください。QChar 型のバリアントの場合、この関数はQMetaType::QChar と同じQVariant::Char を返しますが、char
型のバリアントの場合、この関数はQVariant::Char とは異なる QMetaType::Char を返します。
また、型void*
、long
、short
、unsigned
、long
、unsigned
、short
、unsigned
、char
、float
、QObject*
、QWidget*
は、QMetaType::Type では表現されているが、QVariant::Type では表現されておらず、この関数で返すことができることに注意。しかし、QVariant::Type に対してテストする場合、これらはユーザー定義型とみなされる。
QVariant のインスタンスに、目的のデータ型と互換性のあるデータ型が含まれているかどうかをテストするには、canConvert() を使用する。
userType() およびmetaType()も参照のこと 。
[static, deprecated in 6.0]
const char *QVariant::typeToName(int typeId)
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにQMetaType(typeId).name()
を使用してください。
格納型typeId の int 表現を文字列表現に変換します。
型がQMetaType::UnknownType であるか、存在しない場合はnullptr
を返します。
関連する非会員
[deprecated in 6.0]
QDataStream &operator<<(QDataStream &s, const QVariant::Type p)
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにストリームQMetaType::Type 。
バリアント型p をストリームs に書き込みます。
[deprecated in 6.0]
QDataStream &operator>>(QDataStream &s, QVariant::Type &p)
この関数は6.0から非推奨となった。新しいコードでは使用しないことを強くお勧めします。
代わりにストリームQMetaType::Type 。
ストリームs から、enum 表現のバリアント型p を読み込みます。
© 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.