標準 C++ 對象模型為對象範式,提供瞭非常有效的運行時支持。但其靜態性質在某些問題領域是不靈活的。GUI (圖形用戶界麵) 編程要求運行時高效,且高級靈活性的兩者領域。Qt 通過組閤 C++ 的速度與 Qt 對象模型的靈活性,提供這。
Qt 把這些特徵添加到 C++:
Many of these Qt features are implemented with standard C++ techniques, based on inheritance from QObject . Others, like the object communication mechanism and the dynamic property system, require the 元對象係統 provided by Qt's own MOC (元對象編譯器) .
The meta-object system is a C++ extension that makes the language better suited to true component GUI programming.
這些類形成 Qt 對象模型的基礎。
| QMetaClassInfo | 有關類的額外信息 |
| QMetaEnum | 有關枚舉器的元數據 |
| QMetaMethod | 關於成員函數的元數據 |
| QMetaProperty | 關於特性的元數據 |
| QMetaType | 在元對象係統中管理命名類型 |
| QObject | 所有 Qt 對象的基類 |
| QSignalBlocker | 圍繞 QObject::blockSignals() 的異常安全包裹器 |
| QObjectCleanupHandler | 看守多個 QObject 的壽命 |
| QMetaObject | 包含有關 Qt 對象的元信息 |
| QPointer | 提供指嚮 QObject 守衛指針的模闆類 |
| QSignalMapper | 捆綁來自可識彆發送器的信號 |
| QVariant | 舉動像最常見 Qt 數據類型的並集 |
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.
Qt 對象 ...
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 拷貝構造函數和賦值運算符 disabled.