summaryrefslogtreecommitdiffstats
path: root/examples/sql
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-11 01:00:56 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-03-11 15:34:21 +0100
commit865afac25036d58b18794384e37d42931b2164c5 (patch)
treee18d31138f1a8b9200764fd3648e58b9dd6b124f /examples/sql
parent01bacdf7abb071198d843acdfb22ce1701766be8 (diff)
parent52de905d0ec6159d3a1e7ad63fed018b5c6973d2 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'examples/sql')
-rw-r--r--examples/sql/doc/src/drilldown.qdoc3
-rw-r--r--examples/sql/drilldown/imageitem.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/examples/sql/doc/src/drilldown.qdoc b/examples/sql/doc/src/drilldown.qdoc
index 8beb515a83..a7a9601c26 100644
--- a/examples/sql/doc/src/drilldown.qdoc
+++ b/examples/sql/doc/src/drilldown.qdoc
@@ -437,6 +437,9 @@
\snippet drilldown/imageitem.h 0
+ We declare a \c Type enum value for our custom item and reimplement
+ \l{QGreaphicsItem::}{type()}. This is done so we can safely use
+ qgraphicsitem_cast().
In addition, we implement a public \c id() function to be able to
identify the associated location and a public \c adjust() function
that can be called to ensure that the image item is given the
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;