rock_widget_collection  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FillItem Class Reference

#include <FillItem.h>

Inherits DrawItem.

Inherited by ArrowItem, PolylineItem, and RectangleItem.

Public Member Functions

 FillItem (int posX, int posY, int groupNr, const QColor &color)
 
bool isDrawBorder ()
 
QColor * getInteriorColor ()
 
void setDrawBorder (bool drawBorder)
 
void setInteriorColor (QColor *interiorColor)
 
void draw (QPainter *painter, QRectF &source, QRectF &target)
 
- Public Member Functions inherited from DrawItem
 DrawItem (int posX, int posY, int groupNr, const QColor &color)
 
virtual ~DrawItem ()
 
virtual DrawType getType ()=0
 
bool operator== (const DrawItem &other)
 
virtual void renderOnGl (QGLWidget &widget, QRectF &source, QRectF &target)
 
int getPosY ()
 
int getGroupNr ()
 
QColor getColor ()
 
void setPosX (int posX)
 
void setPosY (int posY)
 
void setGroupNr (int groupNr)
 
void setColor (const QColor &color)
 
int getLineWidth ()
 
Qt::PenStyle getPenStyle ()
 
Qt::PenCapStyle getPenCapStyle ()
 
void setLineWidth (int lineWidth)
 
void setPenStyle (Qt::PenStyle penStyle)
 
void setPenCapStyle (Qt::PenCapStyle penCapStyle)
 
int getID () const
 
void openGL (bool value)
 
bool onOpenGL ()
 
void setPosFactor (float fx, float fy)
 

Protected Member Functions

void addBrushStyle (QPainter *painter)
 
- Protected Member Functions inherited from DrawItem
void addPenStyle (QPainter *painter)
 

Protected Attributes

bool drawBorder
 
QColor * interiorColor
 
- Protected Attributes inherited from DrawItem
int groupNr
 
int posX
 
int posY
 
QColor color
 
int lineWidth
 
Qt::PenCapStyle penCapStyle
 
Qt::PenStyle penStyle
 
int m_id
 
float position_factor_x
 
float position_factor_y
 
bool brender_on_opengl
 

Additional Inherited Members

- Public Slots inherited from DrawItem
int getPosX ()
 
- Static Protected Attributes inherited from DrawItem
static int _ID = 0
 

Detailed Description

Abstract class which extends the DrawItem with fillable functionality. All shapes which need support for filling should subclass FillItem instead of DrawItem. Note that if no border is drawn and no interiorColor is given nothing will be drawn.

Definition at line 19 of file FillItem.h.

Constructor & Destructor Documentation

◆ FillItem()

FillItem::FillItem ( int  posX,
int  posY,
int  groupNr,
const QColor &  color 
)

Generates a FillItem

Parameters
posXthe xposition
posYthe y poistion
groupNrthe group number
colorthe border color

Definition at line 11 of file FillItem.cc.

13 {
14  drawBorder = true;
15  interiorColor = NULL;
16 }
DrawItem(int posX, int posY, int groupNr, const QColor &color)
Definition: DrawItem.cc:11
QColor * interiorColor
Definition: FillItem.h:68
int posY
Definition: DrawItem.h:182
int posX
Definition: DrawItem.h:180
bool drawBorder
Definition: FillItem.h:66
int groupNr
Definition: DrawItem.h:169
QColor color
Definition: DrawItem.h:184

Member Function Documentation

◆ addBrushStyle()

void FillItem::addBrushStyle ( QPainter *  painter)
protected

Adds the brush style handling filling the shape

Parameters
painterthe apinter with which to draw the shape afterwards

Definition at line 18 of file FillItem.cc.

19 {
20  if(interiorColor != NULL)
21  {
22  painter->setBrush(*interiorColor);
23  }
24 }
QColor * interiorColor
Definition: FillItem.h:68

◆ draw()

void FillItem::draw ( QPainter *  painter,
QRectF &  source,
QRectF &  target 
)
virtual
See also
DrawItem::draw(QPainter*)

Implements DrawItem.

Reimplemented in PolylineItem, RectangleItem, and PolygonItem.

Definition at line 26 of file FillItem.cc.

27 {
28  if(!drawBorder)
29  {
30  painter->setPen(Qt::NoPen);
31  }
32  else
33  {
34  addPenStyle(painter);
35  }
36  addBrushStyle(painter);
37 }
void addPenStyle(QPainter *painter)
Definition: DrawItem.cc:27
void addBrushStyle(QPainter *painter)
Definition: FillItem.cc:18
bool drawBorder
Definition: FillItem.h:66

◆ getInteriorColor()

QColor* FillItem::getInteriorColor ( )
inline

Retunrs the fill color or NULL if the shape shall not be filles

Returns
teh fill color or NULL

Definition at line 41 of file FillItem.h.

41 {return interiorColor;};
QColor * interiorColor
Definition: FillItem.h:68

◆ isDrawBorder()

bool FillItem::isDrawBorder ( )
inline

Returns whether the border is drawn

Returns
if the border shall be drawn

Definition at line 35 of file FillItem.h.

35 {return drawBorder;};
bool drawBorder
Definition: FillItem.h:66

◆ setDrawBorder()

void FillItem::setDrawBorder ( bool  drawBorder)
inline

Sets whether a border shall be drawn

Parameters
drawBorderif a border shall be drawn

Definition at line 47 of file FillItem.h.

47 {this->drawBorder = drawBorder;};
bool drawBorder
Definition: FillItem.h:66

◆ setInteriorColor()

void FillItem::setInteriorColor ( QColor *  interiorColor)
inline

Sets the color to fill the shape

Parameters
interiorColorthe color to fill the shape or a NULL pointer if no filling is available

Definition at line 53 of file FillItem.h.

53 {this->interiorColor = interiorColor;};
QColor * interiorColor
Definition: FillItem.h:68

Member Data Documentation

◆ drawBorder

bool FillItem::drawBorder
protected

Determines whether the border is drawn

Definition at line 66 of file FillItem.h.

◆ interiorColor

QColor* FillItem::interiorColor
protected

The interior color if a fill shoud take place or NULL otherwise

Definition at line 68 of file FillItem.h.


The documentation for this class was generated from the following files: