summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-06-03 12:14:09 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-11 09:49:23 (GMT)
commit05cb12eb18605aa32ff7a6761ff82d86aa339995 (patch)
treebb21b0addc7407361071d95daedd1466f0851dc4 /src/gui/graphicsview/qgraphicsitem.h
parent615f8a53355ea501e489eecddab1d5c4295cab80 (diff)
downloadQt-05cb12eb18605aa32ff7a6761ff82d86aa339995.zip
Qt-05cb12eb18605aa32ff7a6761ff82d86aa339995.tar.gz
Qt-05cb12eb18605aa32ff7a6761ff82d86aa339995.tar.bz2
add a QGraphicsObject class and change QGraphicsWidget and QGraphicsTextItem to inherit from it
This changes the inheritance hierarchy of QGraphicsWidget from multiply inheriting from QObject, QGraphicsItem and QGraphicsLayoutItem to inherit from QGraphicsObject and QGraphicsLayoutItem. QGraphicsObject then simply inherits from QObject and QGraphicsItem. This change is binary compatible as it will leave the vtable layout unchanged and as the parent class doesn't appear in the C++ name mangling on any of our platforms. It's also source compatible as it isn't noticable by existing code. The restriction we have on QGraphicsObject is that we can not add any new virtual methods to it, or add data members to the class. We can however implement a QGraphicsObjectprivate inheriting from QGraphicsItemPrivate if there is a need to add data members to the class. This change will allow us to now have one single base for all QGraphicsItems that inherit from QObject: QGraphicsTextItem, QGraphicsWidget and in the future QFxItem. Having that single base class will significantly simplify our work in the qml engine. Reviewed-by: Andreas
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.h')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index cff4f1f..a9b5d71 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -832,10 +832,20 @@ private:
inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay)
{ setOffset(QPointF(ax, ay)); }
+class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsItem)
+public:
+ QGraphicsObject(QGraphicsItem *parent = 0);
+protected:
+ QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);
+};
+
class QGraphicsTextItemPrivate;
class QTextDocument;
class QTextCursor;
-class Q_GUI_EXPORT QGraphicsTextItem : public QObject, public QGraphicsItem
+class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject
{
Q_OBJECT
QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)