30 #include "../../core/pattern/mvc/ItemController.h"
31 #include "../../core/AbstractScene.h"
32 #include "../../core/pattern/mvc/Observable.h"
33 #include "../../../color/RGBAColor.h"
34 #include "../../../qt/widgets/Utils.h"
35 #include "../../../geometry/Envelope.h"
36 #include "../../../common/STLUtils.h"
37 #include "../../item/RectangleModel.h"
42 m_nameClass = std::string(this->metaObject()->className());
65 drawBackground(painter);
67 drawRectangle(painter);
72 if (option->state & QStyle::State_Selected)
74 drawSelection(painter);
88 QPainterPath rect_path;
89 rect_path.addRect(boundingRect());
98 cbrush.setRed(clrBack.
getRed());
100 cbrush.setBlue(clrBack.
getBlue());
101 cbrush.setAlpha(clrBack.
getAlpha());
103 painter->setBrush(cbrush);
104 painter->drawPath(rect_path);
Abstract class to represent an observable. "Model" part of MVC component.
int getRed() const
It returns the red component color value (a value from 0 to 255).
virtual ~RectangleItem()
Destructor.
virtual void drawRectangle(QPainter *painter)
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getGreen() const
It returns the green component color value (a value from 0 to 255).
Abstract class to represent a controller. "Controller" part of MVC component. All classes representin...
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented from QGraphicsItem.
Abstract class that represents a graphic item. This object is of type QGraphicsObject.
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
std::string m_nameClass
Class name.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented from QGraphicsItem.
virtual te::color::RGBAColor getBackgroundColor()
Returns the background color of the MVC component.
Class that represents a graphic Rectangle. Its coordinate system is the same of scene (millimeters)...
Class that represents a "Model" part of Rectangle MVC component. Its coordinate system is the same of...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
RectangleItem(ItemController *controller, Observable *o)
Constructor.