Frapper  1.0a
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
PainterPanel::PainterGraphicsView Class Reference

#include <PainterGraphicsView.h>

Inheritance diagram for PainterPanel::PainterGraphicsView:
Inheritance graph
[legend]
Collaboration diagram for PainterPanel::PainterGraphicsView:
Collaboration graph
[legend]

Public Types

enum  DrawMode {
  NONE = 0, PAINT, LINE, RECT,
  CIRCLE, ELLIPSE, POLYGON, POLYLINE,
  CURVE, CLOSEDCURVE, NUM_MODES
}
 

Public Slots

void onSelectionChanged ()
 Call this Slot when the selected item in the scene changes.
 
void changeBrush (QBrush brush)
 Call this Slot when the brush changes Updates the currently selected items.
 
void changePen (QPen pen)
 Call this Slot when the pen changes Updates the currently selected items.
 
- Public Slots inherited from Frapper::BaseGraphicsView
void homeView ()
 Resets the network graphics view's matrix.
 
void frameAll ()
 Changes the viewing transformation so that all items are visible at maximum zoom level.
 
void frameSelected ()
 Changes the viewing transformation so that the selected items are visible at maximum zoom level.
 
void toggleScrollbars (bool visible)
 Toggles the visibility of scrollbars for the network graphics view.
 

Signals

void triggerRedraw ()
 This signal is emitted when the scene has changed.
 
void sceneChanged (QGraphicsScene *scene)
 This signal is emitted when the scene has changed.
 
void drawModeChanged (int mode)
 This signal is emitted when the drawmode has changed.
 
void penChanged (QPen pen)
 This signal is emitted when the current pen has changed, e.g. by selection.
 
void brushChanged (QBrush brush)
 This signal is emitted when the current brush has changed, e.g. by selection.
 
void selectionChanged (QList< QGraphicsItem * > items)
 This signal is emitted when the scene selection changes.
 

Public Member Functions

 PainterGraphicsView (QWidget *parent=0, Qt::WindowFlags flags=0)
 Constructor of the PainterGraphicsView class.
 
virtual ~PainterGraphicsView ()
 Destructor of the PainterGraphicsView class.
 
void renderToImage (QImage &image)
 Render content of current scene to a QImage.
 
void setDrawMode (DrawMode drawmode)
 Set the current draw mode that defines which item is created on interaction with the graphics view.
 
void setCurrentScene (PainterGraphicsScene *scene)
 Set the current scene painter graphics scene to the given scene and listen to changes of this scene.
 
- Public Member Functions inherited from Frapper::BaseGraphicsView
 BaseGraphicsView (QWidget *parent=0)
 Constructor of the BaseGraphicsView class.
 
virtual ~BaseGraphicsView ()
 Destructor of the BaseGraphicsView class.
 

Protected Member Functions

virtual void mouseMoveEvent (QMouseEvent *event)
 The overwritten event handler for the mouse move event.
 
virtual void mousePressEvent (QMouseEvent *event)
 The overwritten event handler for the mouse press event.
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 The overwritten event handler for the mouse release event.
 
virtual void keyPressEvent (QKeyEvent *event)
 The overwritten event handler for the key press event.
 
- Protected Member Functions inherited from Frapper::BaseGraphicsView
virtual void keyReleaseEvent (QKeyEvent *event)
 Event handler for key release events.
 
virtual void wheelEvent (QWheelEvent *event)
 Event handler for mouse wheel events.
 
void zoomIn ()
 Changes the scale of the graphics scene so that it appears bigger in the graphics view.
 
void zoomOut ()
 Changes the scale of the graphics scene so that it appears smaller in the graphics view.
 
void setScale (qreal s)
 Sets the scale of the viewing transformation matrix that is used for displaying the graphics scene.
 
void frame (const QRectF &rect)
 Sets the viewing transformation so that the given bounding rectangle is fully visible in the graphics view, and centers the bounding rectangle in the middle of the view.
 

Private Member Functions

void toggleDrawmode ()
 Step through the different draw modes.
 
void clearScene ()
 Clear the current and remove all items.
 
BaseShapeItemcreateGraphicsItem (QPointF pos)
 Create a new GraphicsItem at the given position according to the currently selected drawmode.
 

Private Attributes

BaseShapeItemm_currentItem
 The graphics item which is currently created.
 
QBrush m_brush
 The current brush to apply to new graphics items.
 
QPen m_pen
 The current pen to apply to new graphics items.
 
DrawMode m_drawMode
 The current draw mode.
 

Additional Inherited Members

- Protected Attributes inherited from Frapper::BaseGraphicsView
bool m_viewMode
 Flag that states whether the viewing mode is activated.
 
QPoint m_lastPosition
 The last position of the mouse pointer over the viewport.
 

Member Enumeration Documentation

Enumerator:
NONE 
PAINT 
LINE 
RECT 
CIRCLE 
ELLIPSE 
POLYGON 
POLYLINE 
CURVE 
CLOSEDCURVE 
NUM_MODES 

Constructor & Destructor Documentation

PainterPanel::PainterGraphicsView::PainterGraphicsView ( QWidget *  parent = 0,
Qt::WindowFlags  flags = 0 
)

Constructor of the PainterGraphicsView class.

Constructors and Destructors.

Parameters
parentThe parent widget the created instance will be a child of.
flagsExtra widget options.

Constructor of the PainterGraphicsView class.

Parameters
parentThe parent widget the created instance will be a child of.
flagsExtra widget options.
PainterPanel::PainterGraphicsView::~PainterGraphicsView ( )
virtual

Destructor of the PainterGraphicsView class.

Defined virtual to guarantee that the destructor of a derived class will be called if the instance of the derived class is saved in a variable of its parent class type.

Member Function Documentation

void PainterPanel::PainterGraphicsView::renderToImage ( QImage &  image)

Render content of current scene to a QImage.

Parameters
imageThe image to render to
void PainterPanel::PainterGraphicsView::setDrawMode ( DrawMode  drawmode)

Set the current draw mode that defines which item is created on interaction with the graphics view.

Parameters
drawmodeThe drawmode to be used
void PainterPanel::PainterGraphicsView::setCurrentScene ( PainterGraphicsScene scene)

Set the current scene painter graphics scene to the given scene and listen to changes of this scene.

Parameters
sceneThe scene to be used
void PainterPanel::PainterGraphicsView::onSelectionChanged ( )
slot

Call this Slot when the selected item in the scene changes.

Public Slots.

void PainterPanel::PainterGraphicsView::changeBrush ( QBrush  brush)
slot

Call this Slot when the brush changes Updates the currently selected items.

Parameters
brushThe new brush to be applied to the selected items
void PainterPanel::PainterGraphicsView::changePen ( QPen  pen)
slot

Call this Slot when the pen changes Updates the currently selected items.

Parameters
penThe new pen to be applied to the selected items
void PainterPanel::PainterGraphicsView::triggerRedraw ( )
signal

This signal is emitted when the scene has changed.

void PainterPanel::PainterGraphicsView::sceneChanged ( QGraphicsScene *  scene)
signal

This signal is emitted when the scene has changed.

void PainterPanel::PainterGraphicsView::drawModeChanged ( int  mode)
signal

This signal is emitted when the drawmode has changed.

void PainterPanel::PainterGraphicsView::penChanged ( QPen  pen)
signal

This signal is emitted when the current pen has changed, e.g. by selection.

void PainterPanel::PainterGraphicsView::brushChanged ( QBrush  brush)
signal

This signal is emitted when the current brush has changed, e.g. by selection.

void PainterPanel::PainterGraphicsView::selectionChanged ( QList< QGraphicsItem * >  items)
signal

This signal is emitted when the scene selection changes.

void PainterPanel::PainterGraphicsView::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

The overwritten event handler for the mouse move event.

Parameters
eventThe description of the mouse move event.

Reimplemented from Frapper::BaseGraphicsView.

void PainterPanel::PainterGraphicsView::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

The overwritten event handler for the mouse press event.

The overwritten the event handler for the drag move event.

Parameters
eventThe description of the mouse press event.
eventThe description of the drag move event.

Reimplemented from Frapper::BaseGraphicsView.

void PainterPanel::PainterGraphicsView::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual

The overwritten event handler for the mouse release event.

Parameters
eventThe description of the mouse release event.

Reimplemented from Frapper::BaseGraphicsView.

void PainterPanel::PainterGraphicsView::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

The overwritten event handler for the key press event.

Parameters
eventThe description of the key press event.

Reimplemented from Frapper::BaseGraphicsView.

void PainterPanel::PainterGraphicsView::toggleDrawmode ( )
private

Step through the different draw modes.

void PainterPanel::PainterGraphicsView::clearScene ( )
private

Clear the current and remove all items.

BaseShapeItem * PainterPanel::PainterGraphicsView::createGraphicsItem ( QPointF  pos)
private

Create a new GraphicsItem at the given position according to the currently selected drawmode.

Parameters
posThe initial position of the new graphics item

Member Data Documentation

BaseShapeItem* PainterPanel::PainterGraphicsView::m_currentItem
private

The graphics item which is currently created.

QBrush PainterPanel::PainterGraphicsView::m_brush
private

The current brush to apply to new graphics items.

QPen PainterPanel::PainterGraphicsView::m_pen
private

The current pen to apply to new graphics items.

DrawMode PainterPanel::PainterGraphicsView::m_drawMode
private

The current draw mode.


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