ホーム · All Namespaces · 全てのクラス · メインのクラス · グループ別 · Modules · 関数一覧

Qt オブジェクトモデル

Standard C++ のオブジェクトモデルでは、枠組みとして効率を重視したランタイムを提供しています。しかし、この静的な世界はある問題領域にとって柔軟性に乏しいものです。GUIプログラミングは効率の良いランタイムと高位の柔軟性の両方が要求される領域です。Qt は C++ のスピードとQt オブジェクトモデルの柔軟性を結合することでこの要求を満たそうとしています。

Qt は以下のような機能を C++ に追加しています。

これらの Qt の機能の大半は QObjectの継承に基づいて、標準的な C++ の範囲で実装されています。他のオブジェクト間通信や動的なプロパティなどは Meta-Object System が必要ですが、それも Qt 自身の Meta-Object Compiler (moc)により提供されています。

メタオブジェクトシステムは C++ の拡張で、GUI プログラミングをする言語に真にふさわしいものにします。テンプレートは C++ を拡張するために使用することができますが、メタオブジェクトシステムはテンプレートには実現不可能な機能を提供します。右記も参照してください。 "なぜ Qt はテンプレートをシグナルとスロットに使わないの?"

Qt Objects: Identity vs Value

Some of the added features listed above for the Qt Object Model, require that we think of Qt Objects as identities, not values. Values are copied or assigned; identities are cloned. Cloning means to create a new identity, not an exact copy of the old one. For example, twins have different identities. They may look identical, but they have different names, different locations, and may have completely different social networks.

Then cloning an identity is a more complex operation than copying or assigning a value. We can see what this means in the Qt Object Model.

A Qt Object...

For these reasons, Qt Objects should be treated as identities, not as values. Identities are cloned, not copied or assigned, and cloning an identity is a more complex operation than copying or assigning a value. Therefore, QObject and all subclasses of QObject (direct or indirect) have their copy constructor and assignment operator disabled.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.5.0