KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
ellipsegraphicsitem.h
1#ifndef ELLIPSEGRAPHICSITEM_H
2#define ELLIPSEGRAPHICSITEM_H
3#include <QGraphicsEllipseItem>
4#include <Kanoop/gui/libkanoopgui.h>
5
6/**
7 * @brief QGraphicsEllipseItem with an application-defined type integer and appearance helpers.
8 *
9 * EllipseGraphicsItem stores a type integer (returned by type()) that allows
10 * qgraphicsitem_cast<> and scene item-type filtering to work with custom types.
11 */
12class LIBKANOOPGUI_EXPORT EllipseGraphicsItem : public QGraphicsEllipseItem
13{
14public:
15 /**
16 * @brief Construct with a type integer and optional parent item.
17 * @param type Application-defined graphics item type
18 * @param parent Optional parent QGraphicsItem
19 */
20 EllipseGraphicsItem(int type, QGraphicsItem* parent = nullptr);
21
22 /**
23 * @brief Return the application-defined type integer.
24 * @return Item type value
25 */
26 virtual int type() const override { return _type; }
27
28 /**
29 * @brief Set the pen width of the ellipse outline.
30 * @param width Pen width in scene units
31 */
32 void setWidth(double width);
33
34 /**
35 * @brief Set the fill and outline color.
36 * @param color Color to apply to the brush and pen
37 */
38 void setColor(const QColor& color);
39
40private:
41 int _type;
42};
43
44#endif // ELLIPSEGRAPHICSITEM_H
QGraphicsEllipseItem with an application-defined type integer and appearance helpers.
EllipseGraphicsItem(int type, QGraphicsItem *parent=nullptr)
Construct with a type integer and optional parent item.
void setWidth(double width)
Set the pen width of the ellipse outline.
virtual int type() const override
Return the application-defined type integer.
void setColor(const QColor &color)
Set the fill and outline color.