Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GraphicsView_ViewPort Class Reference

#include <GraphicsView_ViewPort.h>

Inheritance diagram for GraphicsView_ViewPort:
Inheritance graph

Classes

class  ViewLabel
 

Public Types

enum  InteractionFlag {
  Dragging = 0x0001, Pulling = 0x0002, WheelScaling = 0x0004, EditFlags = Dragging | Pulling | WheelScaling,
  TraceBoundingRect = 0x0008, DraggingByMiddleButton = 0x0010, ImmediateContextMenu = 0x0020, ImmediateSelection = 0x0040,
  Sketching = 0x0080
}
 
enum  ViewLabelPosition {
  VLP_None = 0, VLP_TopLeft = 1, VLP_TopRight = 2, VLP_BottomLeft = 3,
  VLP_BottomRight = 4
}
 
enum  SortType { NoSorting, SelectedFirst, SortByZLevel }
 

Public Slots

void onBoundingRectChanged ()
 

Signals

void vpKeyEvent (QKeyEvent *)
 
void vpMouseEvent (QGraphicsSceneMouseEvent *)
 
void vpWheelEvent (QGraphicsSceneWheelEvent *)
 
void vpContextMenuEvent (QGraphicsSceneContextMenuEvent *)
 
void vpSketchingFinished (QPainterPath)
 
void vpObjectBeforeMoving ()
 
void vpObjectAfterMoving (bool)
 

Public Member Functions

 Q_DECLARE_FLAGS (InteractionFlags, InteractionFlag) enum BlockStatus
 
 GraphicsView_ViewPort (QWidget *theParent)
 
 ~GraphicsView_ViewPort ()
 
GraphicsView_ScenegetScene ()
 
void addItem (QGraphicsItem *theItem)
 
bool isItemAdded (QGraphicsItem *theItem)
 
void removeItem (QGraphicsItem *theItem)
 
GraphicsView_ObjectList getObjects (SortType theSortType=NoSorting) const
 
QRectF objectsBoundingRect (bool theOnlyVisible=false) const
 
QImage dumpView (bool theWholeScene=false, QSizeF theSize=QSizeF())
 
void setSceneGap (double theSceneGap)
 
void setFitAllGap (double theFitAllGap)
 
int interactionFlags () const
 
bool hasInteractionFlag (InteractionFlag theFlag)
 
void setInteractionFlag (InteractionFlag theFlag, bool theIsEnabled=true)
 
void setInteractionFlags (InteractionFlags theFlags)
 
void setViewLabelPosition (ViewLabelPosition thePosition, bool theIsForced=false)
 
void setViewLabelText (const QString &theText)
 
void setMousePositionEnabled (bool theState)
 
QColor backgroundColor () const
 
void setBackgroundColor (const QColor &theColor)
 
bool isForegroundEnabled () const
 
void setForegroundEnabled (bool theState)
 
QSizeF foregroundSize () const
 
void setForegroundSize (const QSizeF &theRect)
 
double foregroundMargin () const
 
void setForegroundMargin (double theMargin)
 
QColor foregroundColor () const
 
void setForegroundColor (const QColor &theColor)
 
QColor foregroundFrameColor () const
 
void setForegroundFrameColor (const QColor &theColor)
 
double foregroundFrameLineWidth () const
 
void setForegroundFrameLineWidth (double theLineWidth)
 
void updateForeground ()
 
void setGridEnabled (bool theState)
 
void setGridCellSize (int theCellSize)
 
void setGridLineStyle (int theLineStyle)
 
void setGridLineColor (const QColor &theLineColor)
 
void updateGrid ()
 
void reset ()
 
void pan (double theDX, double theDY)
 
void setCenter (double theX, double theY)
 
void zoom (double theX1, double theY1, double theX2, double theY2)
 
void fitRect (const QRectF &theRect)
 
void fitSelect ()
 
void fitAll (bool theKeepScale=false)
 
void fitWidth ()
 
bool isTransforming () const
 
void applyTransform ()
 
BlockStatus currentBlock ()
 
virtual void highlight (double theX, double theY)
 
void clearHighlighted ()
 
GraphicsView_ObjectgetHighlightedObject () const
 
virtual int select (const QRectF &theRect, bool theIsAppend)
 
void clearSelected ()
 
void setSelected (GraphicsView_Object *theObject)
 
int nbSelected () const
 
void initSelected ()
 
bool moreSelected ()
 
bool nextSelected ()
 
GraphicsView_ObjectselectedObject ()
 
const GraphicsView_ObjectListgetSelectedObjects () const
 
void startSelectByRect (int x, int y)
 
void drawSelectByRect (int x, int y)
 
void finishSelectByRect ()
 
bool isSelectByRect () const
 
QRect selectionRect ()
 
void prepareToSketch (bool theStatus)
 
bool isPrepareToSketch ()
 
void startSketching (const QPointF &thePoint, bool theIsPath)
 
void drawSketching (const QPointF &thePoint)
 
void finishSketching (bool theStatus)
 
bool isSketching (bool *theIsPath=0) const
 
bool isDragging ()
 
bool startPulling (const QPointF &)
 
void drawPulling (const QPointF &)
 
void finishPulling (bool theStatus)
 
bool isPulling () const
 
bool cancelCurrentOperation ()
 

Static Public Member Functions

static void createCursors ()
 
static void destroyCursors ()
 
static QCursor * getDefaultCursor ()
 
static QCursor * getHandCursor ()
 
static QCursor * getPanCursor ()
 
static QCursor * getPanglCursor ()
 
static QCursor * getZoomCursor ()
 
static QCursor * getSketchCursor ()
 

Protected Slots

void onKeyEvent (QKeyEvent *)
 
void onMouseEvent (QGraphicsSceneMouseEvent *)
 
void onWheelEvent (QGraphicsSceneWheelEvent *)
 
void onContextMenuEvent (QGraphicsSceneContextMenuEvent *)
 

Protected Member Functions

virtual void scrollContentsBy (int theDX, int theDY)
 

Private Member Functions

void initialize ()
 
void cleanup ()
 
void dragObjects (QGraphicsSceneMouseEvent *)
 

Private Attributes

GraphicsView_ScenemyScene
 
double mySceneGap
 
double myFitAllGap
 
GraphicsView_ObjectList myObjects
 
InteractionFlags myInteractionFlags
 
ViewLabelmyViewLabel
 
ViewLabelPosition myViewLabelPosition
 
QGridLayout * myViewLabelLayout
 
bool myIsMousePositionEnabled
 
bool myIsForegroundEnabled
 
QSizeF myForegroundSize
 
double myForegroundMargin
 
QColor myForegroundColor
 
QColor myForegroundFrameColor
 
double myForegroundFrameLineWidth
 
QGraphicsRectItem * myForegroundItem
 
bool myIsGridEnabled
 
int myGridCellSize
 
int myGridLineStyle
 
QColor myGridLineColor
 
QGraphicsPathItem * myGridItem
 
bool myIsTransforming
 
QTransform myCurrentTransform
 
GraphicsView_ObjectmyHighlightedObject
 
double myHighlightX
 
double myHighlightY
 
bool myIsHighlighting
 
GraphicsView_ObjectList mySelectedObjects
 
int mySelectionIterator
 
QRubberBand * myRectBand
 
QPoint myFirstSelectionPoint
 
QPoint myLastSelectionPoint
 
bool myAreSelectionPointsInitialized
 
QGraphicsPathItem * mySketchingItem
 
QPointF mySketchingPoint
 
bool myIsPrepareToSketch
 
bool myIsSketching
 
bool myIsSketchingByPath
 
int myIsDragging
 
QPointF myDragPosition
 
bool myIsDragPositionInitialized
 
bool myIsPulling
 
GraphicsView_ObjectmyPullingObject
 
QCursor myStoredCursor
 

Static Private Attributes

static int nCounter = 0
 
static QCursor * defCursor = 0
 
static QCursor * handCursor = 0
 
static QCursor * panCursor = 0
 
static QCursor * panglCursor = 0
 
static QCursor * zoomCursor = 0
 
static QCursor * sketchCursor = 0
 

Member Enumeration Documentation

Enumerator
Dragging 
Pulling 
WheelScaling 
EditFlags 
TraceBoundingRect 
DraggingByMiddleButton 
ImmediateContextMenu 
ImmediateSelection 
Sketching 
Enumerator
NoSorting 
SelectedFirst 
SortByZLevel 
Enumerator
VLP_None 
VLP_TopLeft 
VLP_TopRight 
VLP_BottomLeft 
VLP_BottomRight 

Constructor & Destructor Documentation

GraphicsView_ViewPort::~GraphicsView_ViewPort ( )

References cleanup(), and myScene.

Member Function Documentation

void GraphicsView_ViewPort::addItem ( QGraphicsItem *  theItem)
void GraphicsView_ViewPort::applyTransform ( )

References getObjects().

QColor GraphicsView_ViewPort::backgroundColor ( ) const
void GraphicsView_ViewPort::cleanup ( )
private

References destroyCursors(), and nCounter.

void GraphicsView_ViewPort::clearHighlighted ( )
void GraphicsView_ViewPort::clearSelected ( )

References mySelectedObjects.

void GraphicsView_ViewPort::destroyCursors ( )
static
void GraphicsView_ViewPort::drawPulling ( const QPointF &  thePoint)
void GraphicsView_ViewPort::drawSelectByRect ( int  x,
int  y 
)
void GraphicsView_ViewPort::drawSketching ( const QPointF &  thePoint)
QImage GraphicsView_ViewPort::dumpView ( bool  theWholeScene = false,
QSizeF  theSize = QSizeF() 
)

References myScene, and objectsBoundingRect().

void GraphicsView_ViewPort::finishPulling ( bool  theStatus)
void GraphicsView_ViewPort::finishSelectByRect ( )
void GraphicsView_ViewPort::finishSketching ( bool  theStatus)
void GraphicsView_ViewPort::fitAll ( bool  theKeepScale = false)
void GraphicsView_ViewPort::fitRect ( const QRectF &  theRect)
void GraphicsView_ViewPort::fitSelect ( )
void GraphicsView_ViewPort::fitWidth ( )
QColor GraphicsView_ViewPort::foregroundColor ( ) const
inline
QColor GraphicsView_ViewPort::foregroundFrameColor ( ) const
inline
double GraphicsView_ViewPort::foregroundFrameLineWidth ( ) const
inline
double GraphicsView_ViewPort::foregroundMargin ( ) const
inline
QSizeF GraphicsView_ViewPort::foregroundSize ( ) const
inline
static QCursor* GraphicsView_ViewPort::getDefaultCursor ( )
inlinestatic
static QCursor* GraphicsView_ViewPort::getHandCursor ( )
inlinestatic
GraphicsView_Object* GraphicsView_ViewPort::getHighlightedObject ( ) const
inline
GraphicsView_ObjectList GraphicsView_ViewPort::getObjects ( SortType  theSortType = NoSorting) const
static QCursor* GraphicsView_ViewPort::getPanCursor ( )
inlinestatic
static QCursor* GraphicsView_ViewPort::getPanglCursor ( )
inlinestatic
GraphicsView_Scene* GraphicsView_ViewPort::getScene ( )
inline
const GraphicsView_ObjectList& GraphicsView_ViewPort::getSelectedObjects ( ) const
inline
static QCursor* GraphicsView_ViewPort::getSketchCursor ( )
inlinestatic
static QCursor* GraphicsView_ViewPort::getZoomCursor ( )
inlinestatic
bool GraphicsView_ViewPort::hasInteractionFlag ( InteractionFlag  theFlag)

References interactionFlags().

void GraphicsView_ViewPort::highlight ( double  theX,
double  theY 
)
virtual
void GraphicsView_ViewPort::initialize ( )
private

References createCursors(), and nCounter.

void GraphicsView_ViewPort::initSelected ( )

References mySelectionIterator.

int GraphicsView_ViewPort::interactionFlags ( ) const

References myInteractionFlags.

bool GraphicsView_ViewPort::isDragging ( )
inline
bool GraphicsView_ViewPort::isForegroundEnabled ( ) const
inline
bool GraphicsView_ViewPort::isItemAdded ( QGraphicsItem *  theItem)

References myObjects, and myScene.

bool GraphicsView_ViewPort::isPrepareToSketch ( )

References myIsPrepareToSketch.

bool GraphicsView_ViewPort::isPulling ( ) const
inline
bool GraphicsView_ViewPort::isSelectByRect ( ) const
bool GraphicsView_ViewPort::isSketching ( bool *  theIsPath = 0) const
bool GraphicsView_ViewPort::isTransforming ( ) const
inline
bool GraphicsView_ViewPort::moreSelected ( )
int GraphicsView_ViewPort::nbSelected ( ) const

References mySelectedObjects.

bool GraphicsView_ViewPort::nextSelected ( )
QRectF GraphicsView_ViewPort::objectsBoundingRect ( bool  theOnlyVisible = false) const
void GraphicsView_ViewPort::onBoundingRectChanged ( )
slot
void GraphicsView_ViewPort::onContextMenuEvent ( QGraphicsSceneContextMenuEvent *  e)
protectedslot

References vpContextMenuEvent().

void GraphicsView_ViewPort::onKeyEvent ( QKeyEvent *  e)
protectedslot

References vpKeyEvent().

void GraphicsView_ViewPort::onWheelEvent ( QGraphicsSceneWheelEvent *  e)
protectedslot

References vpWheelEvent().

void GraphicsView_ViewPort::pan ( double  theDX,
double  theDY 
)
void GraphicsView_ViewPort::prepareToSketch ( bool  theStatus)
GraphicsView_ViewPort::Q_DECLARE_FLAGS ( InteractionFlags  ,
InteractionFlag   
)
inline

References BS_Dragging, BS_NoBlock, and BS_Selection.

void GraphicsView_ViewPort::removeItem ( QGraphicsItem *  theItem)
void GraphicsView_ViewPort::reset ( )

References fitAll().

void GraphicsView_ViewPort::scrollContentsBy ( int  theDX,
int  theDY 
)
protectedvirtual
GraphicsView_Object * GraphicsView_ViewPort::selectedObject ( )
QRect GraphicsView_ViewPort::selectionRect ( )
void GraphicsView_ViewPort::setBackgroundColor ( const QColor &  theColor)
void GraphicsView_ViewPort::setCenter ( double  theX,
double  theY 
)
void GraphicsView_ViewPort::setFitAllGap ( double  theFitAllGap)

References myFitAllGap.

void GraphicsView_ViewPort::setForegroundColor ( const QColor &  theColor)

References myForegroundColor.

void GraphicsView_ViewPort::setForegroundEnabled ( bool  theState)

References myIsForegroundEnabled.

void GraphicsView_ViewPort::setForegroundFrameColor ( const QColor &  theColor)
void GraphicsView_ViewPort::setForegroundFrameLineWidth ( double  theLineWidth)
void GraphicsView_ViewPort::setForegroundMargin ( double  theMargin)

References myForegroundMargin.

void GraphicsView_ViewPort::setForegroundSize ( const QSizeF &  theRect)

References myForegroundSize.

void GraphicsView_ViewPort::setGridCellSize ( int  theCellSize)

References myGridCellSize.

void GraphicsView_ViewPort::setGridEnabled ( bool  theState)

References myIsGridEnabled.

void GraphicsView_ViewPort::setGridLineColor ( const QColor &  theLineColor)

References myGridLineColor.

void GraphicsView_ViewPort::setGridLineStyle ( int  theLineStyle)

References myGridLineStyle.

void GraphicsView_ViewPort::setInteractionFlag ( InteractionFlag  theFlag,
bool  theIsEnabled = true 
)
void GraphicsView_ViewPort::setInteractionFlags ( InteractionFlags  theFlags)

References myInteractionFlags.

void GraphicsView_ViewPort::setMousePositionEnabled ( bool  theState)
void GraphicsView_ViewPort::setSceneGap ( double  theSceneGap)
void GraphicsView_ViewPort::setSelected ( GraphicsView_Object theObject)
void GraphicsView_ViewPort::setViewLabelPosition ( ViewLabelPosition  thePosition,
bool  theIsForced = false 
)
void GraphicsView_ViewPort::setViewLabelText ( const QString &  theText)

References myViewLabel.

bool GraphicsView_ViewPort::startPulling ( const QPointF &  thePoint)

References myIsPulling, and myPullingObject.

void GraphicsView_ViewPort::startSelectByRect ( int  x,
int  y 
)
void GraphicsView_ViewPort::startSketching ( const QPointF &  thePoint,
bool  theIsPath 
)
void GraphicsView_ViewPort::updateGrid ( )
void GraphicsView_ViewPort::vpContextMenuEvent ( QGraphicsSceneContextMenuEvent *  )
signal
void GraphicsView_ViewPort::vpKeyEvent ( QKeyEvent *  )
signal
void GraphicsView_ViewPort::vpMouseEvent ( QGraphicsSceneMouseEvent *  )
signal
void GraphicsView_ViewPort::vpObjectAfterMoving ( bool  )
signal
void GraphicsView_ViewPort::vpObjectBeforeMoving ( )
signal
void GraphicsView_ViewPort::vpSketchingFinished ( QPainterPath  )
signal
void GraphicsView_ViewPort::vpWheelEvent ( QGraphicsSceneWheelEvent *  )
signal
void GraphicsView_ViewPort::zoom ( double  theX1,
double  theY1,
double  theX2,
double  theY2 
)

Member Data Documentation

QCursor * GraphicsView_ViewPort::defCursor = 0
staticprivate
QCursor * GraphicsView_ViewPort::handCursor = 0
staticprivate
bool GraphicsView_ViewPort::myAreSelectionPointsInitialized
private
QTransform GraphicsView_ViewPort::myCurrentTransform
private
QPointF GraphicsView_ViewPort::myDragPosition
private
QPoint GraphicsView_ViewPort::myFirstSelectionPoint
private
double GraphicsView_ViewPort::myFitAllGap
private
QColor GraphicsView_ViewPort::myForegroundColor
private
QColor GraphicsView_ViewPort::myForegroundFrameColor
private
double GraphicsView_ViewPort::myForegroundFrameLineWidth
private
QGraphicsRectItem* GraphicsView_ViewPort::myForegroundItem
private
double GraphicsView_ViewPort::myForegroundMargin
private
QSizeF GraphicsView_ViewPort::myForegroundSize
private
int GraphicsView_ViewPort::myGridCellSize
private
QGraphicsPathItem* GraphicsView_ViewPort::myGridItem
private
QColor GraphicsView_ViewPort::myGridLineColor
private
int GraphicsView_ViewPort::myGridLineStyle
private
GraphicsView_Object* GraphicsView_ViewPort::myHighlightedObject
private
double GraphicsView_ViewPort::myHighlightX
private
double GraphicsView_ViewPort::myHighlightY
private
InteractionFlags GraphicsView_ViewPort::myInteractionFlags
private
int GraphicsView_ViewPort::myIsDragging
private
bool GraphicsView_ViewPort::myIsDragPositionInitialized
private
bool GraphicsView_ViewPort::myIsForegroundEnabled
private
bool GraphicsView_ViewPort::myIsGridEnabled
private
bool GraphicsView_ViewPort::myIsHighlighting
private
bool GraphicsView_ViewPort::myIsMousePositionEnabled
private
bool GraphicsView_ViewPort::myIsPrepareToSketch
private
bool GraphicsView_ViewPort::myIsPulling
private
bool GraphicsView_ViewPort::myIsSketching
private
bool GraphicsView_ViewPort::myIsSketchingByPath
private
bool GraphicsView_ViewPort::myIsTransforming
private
QPoint GraphicsView_ViewPort::myLastSelectionPoint
private
GraphicsView_ObjectList GraphicsView_ViewPort::myObjects
private
GraphicsView_Object* GraphicsView_ViewPort::myPullingObject
private
QRubberBand* GraphicsView_ViewPort::myRectBand
private
GraphicsView_Scene* GraphicsView_ViewPort::myScene
private
double GraphicsView_ViewPort::mySceneGap
private
GraphicsView_ObjectList GraphicsView_ViewPort::mySelectedObjects
private
int GraphicsView_ViewPort::mySelectionIterator
private
QGraphicsPathItem* GraphicsView_ViewPort::mySketchingItem
private
QPointF GraphicsView_ViewPort::mySketchingPoint
private
QCursor GraphicsView_ViewPort::myStoredCursor
private
ViewLabel* GraphicsView_ViewPort::myViewLabel
private
QGridLayout* GraphicsView_ViewPort::myViewLabelLayout
private
ViewLabelPosition GraphicsView_ViewPort::myViewLabelPosition
private
int GraphicsView_ViewPort::nCounter = 0
staticprivate
QCursor * GraphicsView_ViewPort::panCursor = 0
staticprivate
QCursor * GraphicsView_ViewPort::panglCursor = 0
staticprivate
QCursor * GraphicsView_ViewPort::sketchCursor = 0
staticprivate
QCursor * GraphicsView_ViewPort::zoomCursor = 0
staticprivate

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