castToQObject

QObject castToQObject(QObject*)

QObject castToQObject(QGraphicsItem*)

These functions are for pointer-conversions. They return a downcasted QObject* to the most specific type known by the QMetaObject system.

You have no control over the exact destination type. It is discovered at runtime.

For both overloads, the object or one of its base classes must inherit from QObject (first in its base class list if it is multiply-inherited), for the cast to work.

Note: If either of these functions is called on an object that is not derived from QObject, Squish may crash.

Note: QGraphicsItem, because it does not inherit from QObject, does not provide support for introspection. Because the built-in QGraphicsItem-derived classes were processed by squishidl, Squish provides full access to all their methods and properties. However, none of the properties or methods you add to your own QGraphicsItem subclasses can be accessed by Squish unless your custom classes are derived from Q(Graphics)Object with slots and Q_PROPERTY (or processed by squishidl).

For examples of testing Qt's graphics/view classes see How to Test Graphics Views, Graphics Scenes and Graphics Items.

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

Search Results