From a2446c0eede445eb40905487b1ba7c689aa8baef Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 6 Mar 2020 07:29:12 +0100 Subject: Doc: Let SQL Drill Down example show correct use of qgraphicsitem_cast For qgraphicsitem_cast to work correctly with custom items, one must reimplement the type() function for each custom QGraphicsItem subclass. Do that in the example code. Fixes: QTBUG-7357 Change-Id: Ibf221817908355f0347cddfc46747b6955958f5f Reviewed-by: Andy Shaw --- examples/sql/drilldown/imageitem.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'examples/sql/drilldown') diff --git a/examples/sql/drilldown/imageitem.h b/examples/sql/drilldown/imageitem.h index abb9103c7e..324c847b12 100644 --- a/examples/sql/drilldown/imageitem.h +++ b/examples/sql/drilldown/imageitem.h @@ -60,8 +60,11 @@ class ImageItem : public QObject, public QGraphicsPixmapItem Q_OBJECT public: + enum { Type = UserType + 1 }; + ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent = nullptr); + int type() const override { return Type; } void adjust(); int id() const; -- cgit v1.2.3