#include <selectableboxgraphic.h>
Inherited by SelectableTextBlock, and StateBoxGraphic.
Public Types | |
enum | BoxStyle { kSolidWithShadow, kSolidNoShadow, kTransparent } |
enum | ShowBoxStyle { kAlways, kWhenSelected } |
enum | DrawBoxLineStyle { kDrawSolid, kDrawDotted } |
Public Member Functions | |
SelectableBoxGraphic (QGraphicsObject *parent) | |
~SelectableBoxGraphic () | |
virtual void | setSize (QPoint size) |
set the size of this object | |
void | increaseWidth (int inc) |
QString | getPositionAsString () |
QString | getSizeAsString () |
void | getSize (QPoint &size) |
void | setHighlighted (bool) |
void | setShowBoxLineStyle (ShowBoxStyle s) |
show box allways, or only when selected | |
void | setDrawBoxLineStyle (DrawBoxLineStyle s) |
if drawing box, draw solid or dotted line | |
void | setBoxStyle (BoxStyle s) |
set box style | |
void | setHoverLineThickness (int t) |
set line thickness when hovered |
This QGraphicsObject is designed to the base class for all scene objects that will be contained in a box. For example the StateBoxGraphic and SelectableTextBlock both use this class.
This box can be re-sized and it can be moved. For moving, we capture the mouse move events and move the box location accordingly.
To resize the box, we place small indicator boxes on the four corners that give the user a visual cue to grab with the mouse. The user then drags the corner to stretch or shrink the box. The corner grabbers are implemented with the CornerGrabber class. The CornerGrabber class captures the mouse when the mouse is over the corner's area, but the StateBox object (which owns the corners) captures and processes the mouse events on behalf of the CornerGrabbers (because the owner wants to be resized, not the CornerGrabbers themselves). This is accomplished by installed a scene event filter on the CornerGrabber objects: _corners[0]->installSceneEventFilter(this);
SelectableBoxGraphic::SelectableBoxGraphic | ( | QGraphicsObject * | parent | ) |
This box can be re-sized and it can be moved. For moving, we capture the mouse move events and move the box location accordingly.
To resize the box, we place small indicator boxes on the four corners that give the user a visual cue to grab with the mouse. The user then drags the corner to stretch or shrink the box. The corner grabbers are implemented with the CornerGrabber class. The CornerGrabber class captures the mouse when the mouse is over the corner's area, but the SelectableBoxGraphic object (which owns the corners) captures and processes the mouse events on behalf of the CornerGrabbers (because the owner wants to be resized, not the CornerGrabbers themselves). This is accomplished by installing a scene event filter on the CornerGrabber objects: _corners[0]->installSceneEventFilter(this);
SelectableBoxGraphic::~SelectableBoxGraphic | ( | ) |
QString SelectableBoxGraphic::getPositionAsString | ( | ) |
Reimplemented in StateBoxGraphic.
void SelectableBoxGraphic::getSize | ( | QPoint & | size | ) |
Reimplemented in StateBoxGraphic.
QString SelectableBoxGraphic::getSizeAsString | ( | ) |
Reimplemented in StateBoxGraphic.
void SelectableBoxGraphic::increaseWidth | ( | int | inc | ) |
void SelectableBoxGraphic::setBoxStyle | ( | BoxStyle | s | ) |
set box style
void SelectableBoxGraphic::setDrawBoxLineStyle | ( | DrawBoxLineStyle | s | ) |
if drawing box, draw solid or dotted line
void SelectableBoxGraphic::setHighlighted | ( | bool | on | ) |
Reimplemented in StateBoxGraphic.
void SelectableBoxGraphic::setHoverLineThickness | ( | int | t | ) |
set line thickness when hovered
void SelectableBoxGraphic::setShowBoxLineStyle | ( | ShowBoxStyle | s | ) |
show box allways, or only when selected
void SelectableBoxGraphic::setSize | ( | QPoint | size | ) | [virtual] |
set the size of this object
Reimplemented in SelectableTextBlock, and StateBoxGraphic.