Developer Documentation
VSI::Button Class Reference

#include <Plugin-VSI/scene/button.hh>

Inheritance diagram for VSI::Button:
VSI::Text

Signals

void pressed ()
 emmited if the button gets pressed
 

Public Member Functions

 Button (QGraphicsItem *_parent=0)
 Constructor. More...
 
 Button (const QString &_text, QGraphicsItem *_parent=0)
 Constructor. More...
 
 ~Button ()
 Destructor. More...
 
QRectF boundingRect () const override
 Bounding rectangle. More...
 
void setGeometry (const QRectF &_rect) override
 Sets the geometry. More...
 
void paint (QPainter *_painter, const QStyleOptionGraphicsItem *_option, QWidget *_widget=0) override
 Button glow painting. More...
 
void setBackgroundBrush (QBrush _brush) override
 Sets the background brush. More...
 
void setBackgroundPen (QPen _pen) override
 Sets the background pen. More...
 
- Public Member Functions inherited from VSI::Text
 Text (QGraphicsItem *_parent=0)
 Constructor. More...
 
 Text (const QString &_text, QGraphicsItem *_parent=0)
 Constructor. More...
 
 ~Text ()
 Destrucotr. More...
 
virtual void setGeometry (const QRectF &_rect)
 Sets the geometry. More...
 
QPainterPath shape () const
 Returns the shape for proper repainting/event handling. More...
 
virtual void paint (QPainter *_painter, const QStyleOptionGraphicsItem *_option, QWidget *_widget=0)
 Background painting. More...
 
virtual QRectF boundingRect () const
 Bounding rectangle. More...
 
QBrush backgroundBrush ()
 Returns the current background brush. More...
 
virtual void setBackgroundBrush (QBrush _brush)
 Sets the background brush. More...
 
QPen backgroundPen ()
 Returns the current background pen. More...
 
virtual void setBackgroundPen (QPen _pen)
 Sets the background pen. More...
 
void setBackground (bool _leftOut, bool _rightOut)
 Enables background painting. More...
 
void clearBackground ()
 Disables backgorund painting. More...
 
void setHorizontalStretch (bool _stretch)
 Should this widget be stretchable in horizontal direction. More...
 
void setAlignment (Qt::Alignment _alignment)
 Placement of the text in a stretched widget. More...
 
void setText (QString _text)
 Set displayed text. More...
 
QString text ()
 Get displayed text. More...
 

Protected Member Functions

virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *_event) override
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *_event) override
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *_event) override
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *_event) override
 
- Protected Member Functions inherited from VSI::Text
virtual QSizeF sizeHint (Qt::SizeHint _which, const QSizeF &_constraint=QSizeF()) const
 

Private Attributes

QBrush backgroundBrush_
 
QPen backgroundPen_
 
bool glow_
 

Detailed Description

Widgets that represents a clickable button based on VSI::Text

Definition at line 67 of file button.hh.

Constructor & Destructor Documentation

◆ Button() [1/2]

VSI::Button::Button ( QGraphicsItem *  _parent = 0)
explicit

Constructor.

Definition at line 67 of file button.cc.

◆ Button() [2/2]

VSI::Button::Button ( const QString &  _text,
QGraphicsItem *  _parent = 0 
)

Constructor.

Definition at line 78 of file button.cc.

◆ ~Button()

VSI::Button::~Button ( )

Destructor.

Definition at line 89 of file button.cc.

Member Function Documentation

◆ boundingRect()

QRectF VSI::Button::boundingRect ( ) const
overridevirtual

Bounding rectangle.

Reimplemented from VSI::Text.

Definition at line 193 of file button.cc.

◆ hoverEnterEvent()

void VSI::Button::hoverEnterEvent ( QGraphicsSceneHoverEvent *  _event)
overrideprotectedvirtual

Definition at line 96 of file button.cc.

◆ hoverLeaveEvent()

void VSI::Button::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  _event)
overrideprotectedvirtual

Definition at line 110 of file button.cc.

◆ mousePressEvent()

void VSI::Button::mousePressEvent ( QGraphicsSceneMouseEvent *  _event)
overrideprotectedvirtual

Definition at line 121 of file button.cc.

◆ mouseReleaseEvent()

void VSI::Button::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  _event)
overrideprotectedvirtual

Definition at line 134 of file button.cc.

◆ paint()

void VSI::Button::paint ( QPainter *  _painter,
const QStyleOptionGraphicsItem *  _option,
QWidget *  _widget = 0 
)
overridevirtual

Button glow painting.

Reimplemented from VSI::Text.

Definition at line 161 of file button.cc.

◆ setBackgroundBrush()

void VSI::Button::setBackgroundBrush ( QBrush  _brush)
overridevirtual

Sets the background brush.

Reimplemented from VSI::Text.

Definition at line 143 of file button.cc.

◆ setBackgroundPen()

void VSI::Button::setBackgroundPen ( QPen  _pen)
overridevirtual

Sets the background pen.

Reimplemented from VSI::Text.

Definition at line 152 of file button.cc.

◆ setGeometry()

void VSI::Button::setGeometry ( const QRectF &  _rect)
overridevirtual

Sets the geometry.

Reimplemented from VSI::Text.

Definition at line 206 of file button.cc.

Member Data Documentation

◆ backgroundBrush_

QBrush VSI::Button::backgroundBrush_
private

Definition at line 110 of file button.hh.

◆ backgroundPen_

QPen VSI::Button::backgroundPen_
private

Definition at line 111 of file button.hh.

◆ glow_

bool VSI::Button::glow_
private

Definition at line 113 of file button.hh.


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