KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
pixmapgraphicsitem.h
1#ifndef PIXMAPGRAPHICSITEM_H
2#define PIXMAPGRAPHICSITEM_H
3#include <QGraphicsPixmapItem>
4
5#include <Kanoop/gui/libkanoopgui.h>
6
7/**
8 * @brief QGraphicsPixmapItem with an application-defined type integer.
9 *
10 * PixmapGraphicsItem stores a type integer (returned by type()) that allows
11 * qgraphicsitem_cast<> and scene item-type filtering to work with custom types.
12 */
13class LIBKANOOPGUI_EXPORT PixmapGraphicsItem : public QGraphicsPixmapItem
14{
15public:
16 /**
17 * @brief Construct with a type integer and optional parent item.
18 * @param type Application-defined graphics item type
19 * @param parent Optional parent QGraphicsItem
20 */
21 explicit PixmapGraphicsItem(int type, QGraphicsItem* parent = nullptr);
22
23 /**
24 * @brief Return the application-defined type integer.
25 * @return Item type value
26 */
27 virtual int type() const override { return _type; }
28
29protected:
30 /** @brief Handle graphics item change notifications. */
31 virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
32
33private:
34 int _type;
35};
36
37#endif // PIXMAPGRAPHICSITEM_H
QGraphicsPixmapItem with an application-defined type integer.
PixmapGraphicsItem(int type, QGraphicsItem *parent=nullptr)
Construct with a type integer and optional parent item.
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override
Handle graphics item change notifications.
virtual int type() const override
Return the application-defined type integer.