Obsolete Members for QMetaType
QMetaType クラスの以下のメンバーは非推奨となっています。これらは、古いソースコードが動作し続けるように提供されているものです。新しいコードでの使用は強く推奨しません。
静的パブリックメンバー
(deprecated in 6.0) bool | compare(const void *lhs, const void *rhs, int typeId, int *result) |
(deprecated in 6.0) void * | construct(int type, void *where, const void *copy) |
(deprecated in 6.0) bool | convert(const void *from, int fromTypeId, void *to, int toTypeId) |
(deprecated in 6.0) void * | create(int type, const void *copy = nullptr) |
(deprecated in 6.0) bool | debugStream(QDebug &dbg, const void *rhs, int typeId) |
(deprecated in 6.0) void | destroy(int type, void *data) |
(deprecated in 6.0) void | destruct(int type, void *where) |
(deprecated in 6.0) bool | hasRegisteredDebugStreamOperator() |
(deprecated in 6.0) bool | hasRegisteredDebugStreamOperator(int typeId) |
(deprecated in 6.0) bool | load(QDataStream &stream, int type, void *data) |
(deprecated in 6.0) const QMetaObject * | metaObjectForType(int type) |
(deprecated in 6.0) bool | save(QDataStream &stream, int type, const void *data) |
(deprecated in 6.0) int | sizeOf(int type) |
(deprecated in 6.0) int | type(const char *typeName) |
(deprecated in 6.0) int | type(const QByteArray &typeName) |
(deprecated in 6.0) QMetaType::TypeFlags | typeFlags(int type) |
(deprecated in 6.0) const char * | typeName(int typeId) |
関連する非メンバ
(deprecated) int | qRegisterMetaType(const char *typeName) |
メンバ関数のドキュメント
[static, deprecated in 6.0] bool QMetaType::compare(const void *lhs, const void *rhs, int typeId, int *result)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強くお勧めしません。
代わりに、非静的な compare メソッドを使用してください。
lhs とrhs にあるオブジェクトを比較します。両方のオブジェクトはtypeId 型である必要があります。lhs がrhs より小さい、等しい、または大きい場合、result はそれぞれ0より小さい、0より等しい、または0より大きい値に設定されます。比較が成功した場合はtrue を返し、失敗した場合はfalse を返します。
[static, deprecated in 6.0] void *QMetaType::construct(int type, void *where, const void *copy)
この関数はバージョン6.0以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
where で指定されたアドレスにある既存のメモリ領域に、指定されたtype の値(copy のコピー)を構築し、where を返します。copy が0の場合、値はデフォルト構築されます。
これは、この型を格納するために使用されるメモリを明示的に管理するための低レベルな関数です。このレベルの制御が必要ない場合は、create() の呼び出しを検討してください(つまり、「placement new」ではなく「new」を使用してください)。
where が型type の値を格納できる場所を指していること、およびwhere が適切にアラインメントされていることを確認する必要があります。型のサイズは、sizeOf()を呼び出すことで照会できます。
アライメントに関する経験則として、型はその「自然な境界」にアラインされるべきです。自然な境界とは、その型よりも大きい最小の 2 の冪ですが、そのアライメントがプラットフォームの最大有効アライメントを超える場合はこの限りではありません。 実用上、2 * sizeof(void*) を超えるアライメントが必要となるのは、特殊なハードウェア命令(例:x86 におけるアライメント調整済みの SSE ロードおよびストア)の場合に限られます。
destruct() およびsizeOf()も参照してください 。
[static, deprecated in 6.0] bool QMetaType::convert(const void *from, int fromTypeId, void *to, int toTypeId)
この関数はバージョン 6.0 以降で非推奨となっています。新しいコードでの使用は強く推奨しません。
from にあるfromTypeId 型のオブジェクトを、to にあるtoTypeId 型の事前割り当て済み領域に変換します。変換が成功した場合はtrue を返し、失敗した場合はfalseを返します。
from とto の両方が有効なポインタである必要があります。
[static, deprecated in 6.0] void *QMetaType::create(int type, const void *copy = nullptr)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
copy のコピーを返します。ただし、それがtype 型であることを前提とします。copy が0の場合、デフォルトコンストラクタでインスタンスを生成します。
destroy()、isRegistered()、およびTypeも参照してください 。
[static, deprecated in 6.0] bool QMetaType::debugStream(QDebug &dbg, const void *rhs, int typeId)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
これはオーバーロードされた関数です。
[static, deprecated in 6.0] void QMetaType::destroy(int type, void *data)
この関数はバージョン6.0以降で非推奨となっています。新しいコードでの使用は強く推奨しません。
指定されたtype のdata を破棄します。
create()、isRegistered()、およびTypeも参照してください 。
[static, deprecated in 6.0] void QMetaType::destruct(int type, void *where)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
where にある、指定された `type` の値を破棄します。
destroy() とは異なり、この関数は型のデストラクタのみを呼び出し、delete 演算子は呼び出しません。
construct()も参照してください 。
[static, deprecated in 6.0] template <typename T> bool QMetaType::hasRegisteredDebugStreamOperator()
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
メタ型システムに型 T 用のデバッグストリーム演算子が登録されている場合、true を返します。
[static, deprecated in 6.0] bool QMetaType::hasRegisteredDebugStreamOperator(int typeId)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
代わりに `QMetaType::hasRegisteredDebugStreamOperator()` を使用してください。
メタ型システムに、型 ID `typeId` 用のデバッグストリーム演算子が登録されている場合、true を返します。
[static, deprecated in 6.0] bool QMetaType::load(QDataStream &stream, int type, void *data)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強くお勧めしません。
これはオーバーロードされた関数です。
[static, deprecated in 6.0] const QMetaObject *QMetaType::metaObjectForType(int type)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
以下の場合、QMetaType::metaObject を返します。type
metaObject()も参照してください 。
[static, deprecated in 6.0] bool QMetaType::save(QDataStream &stream, int type, const void *data)
この関数は 6.0 以降、非推奨となっています。新しいコードでの使用は絶対にお控えください。
これはオーバーロードされた関数です。
[static, deprecated in 6.0] int QMetaType::sizeOf(int type)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
指定されたtype のサイズをバイト単位で返します(つまり、sizeof(T)に相当します。ここで、Tはtype 引数によって識別される実際の型です)。
この関数は通常、construct() と組み合わせて使用され、型が使用するメモリの低レベルな管理を行います。
construct() およびQMetaType::alignOf()も参照してください 。
[static, deprecated in 6.0] int QMetaType::type(const char *typeName)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
typeName という型のハンドルを返します。そのような型が存在しない場合は、QMetaType::UnknownType を返します。
isRegistered()、typeName()、およびTypeも参照してください 。
[static, deprecated in 6.0] int QMetaType::type(const QByteArray &typeName)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
typeName と呼ばれる型のハンドルを返します。そのような型が存在しない場合は0を返します。
これはオーバーロードされた関数です。
isRegistered() およびtypeName()も参照してください 。
[static, deprecated in 6.0] QMetaType::TypeFlags QMetaType::typeFlags(int type)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
指定されたtype のフラグを返します。
QMetaType::TypeFlagsも参照してください 。
[static, deprecated in 6.0] const char *QMetaType::typeName(int typeId)
この関数はバージョン 6.0 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。
指定されたtypeId に関連付けられた型名を返します。一致する型が見つからない場合は、nullポインタを返します。返されたポインタをdeleteしてはなりません。
関連項目: type()、isRegistered()、Type 、およびname()。
関連する非メンバー関数
[deprecated] template <typename T> int qRegisterMetaType(const char *typeName)
この関数は非推奨となっています。新しいコードでの使用は強くお勧めしません。
型 `T` に対して、型名 `typeName ` を登録します。QMetaType で使用される内部 ID を返します。パブリックのデフォルトコンストラクタ、パブリックのコピーコンストラクタ、およびパブリックのデストラクタを持つクラスや構造体であれば、登録可能です。
この関数を呼び出す時点で、T が完全に定義済みの型であることが必要です。ポインタ型の場合、そのポインタが指す型も完全に定義されている必要があります。前方宣言された型へのポインタを登録するには、Q_DECLARE_OPAQUE_POINTER() を使用してください。
型が登録されると、実行時にその型のオブジェクトを動的に生成および破棄できるようになります。
この例では、クラス `MyClass` を登録します:
qRegisterMetaType<MyClass>("MyClass");この関数は、QMetaProperty や QueuedConnections で使用できるように、typedef を登録するのに役立ちます。
typedefQString CustomString;
qRegisterMetaType<CustomString>("CustomString");警告:この関数は 、エイリアス(typedef)を登録する場合にのみ有用です。それ以外の用途では、代わりにQ_DECLARE_METATYPE およびqMetaTypeId() を使用してください。
isRegistered() およびQ_DECLARE_METATYPE()も参照してください 。
© 2026 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.