#include <GraphicsView_ViewPort.h>
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_Scene * | getScene () |
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_Object * | getHighlightedObject () 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_Object * | selectedObject () |
const GraphicsView_ObjectList & | getSelectedObjects () 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 *) |
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 |
GraphicsView_ViewPort::GraphicsView_ViewPort | ( | QWidget * | theParent | ) |
References EditFlags, initialize(), myFitAllGap, myForegroundColor, myForegroundFrameColor, myForegroundFrameLineWidth, myForegroundMargin, myForegroundSize, myGridCellSize, myGridLineColor, myGridLineStyle, myIsForegroundEnabled, myIsGridEnabled, myScene, mySceneGap, onBoundingRectChanged(), onContextMenuEvent(), onKeyEvent(), onMouseEvent(), onWheelEvent(), and setInteractionFlags().
void GraphicsView_ViewPort::addItem | ( | QGraphicsItem * | theItem | ) |
References myObjects, myScene, and onBoundingRectChanged().
void GraphicsView_ViewPort::applyTransform | ( | ) |
References getObjects().
QColor GraphicsView_ViewPort::backgroundColor | ( | ) | const |
bool GraphicsView_ViewPort::cancelCurrentOperation | ( | ) |
|
private |
References destroyCursors(), and nCounter.
void GraphicsView_ViewPort::clearHighlighted | ( | ) |
References myHighlightedObject, and GraphicsView_Object::unhighlight().
void GraphicsView_ViewPort::clearSelected | ( | ) |
References mySelectedObjects.
|
static |
GraphicsView_ViewPort::BlockStatus GraphicsView_ViewPort::currentBlock | ( | ) |
|
static |
References defCursor, handCursor, panCursor, panglCursor, sketchCursor, and zoomCursor.
|
private |
void GraphicsView_ViewPort::drawPulling | ( | const QPointF & | thePoint | ) |
References getSelectedObjects(), myPullingObject, and GraphicsView_Object::pull().
void GraphicsView_ViewPort::drawSelectByRect | ( | int | x, |
int | y | ||
) |
References myAreSelectionPointsInitialized, myLastSelectionPoint, myRectBand, and selectionRect().
void GraphicsView_ViewPort::drawSketching | ( | const QPointF & | thePoint | ) |
References isSketching(), mySketchingItem, and mySketchingPoint.
QImage GraphicsView_ViewPort::dumpView | ( | bool | theWholeScene = false , |
QSizeF | theSize = QSizeF() |
||
) |
References myScene, and objectsBoundingRect().
void GraphicsView_ViewPort::finishPulling | ( | bool | theStatus | ) |
void GraphicsView_ViewPort::finishSelectByRect | ( | ) |
References myAreSelectionPointsInitialized, and myRectBand.
void GraphicsView_ViewPort::finishSketching | ( | bool | theStatus | ) |
References getDefaultCursor(), myIsSketching, mySketchingItem, prepareToSketch(), and vpSketchingFinished().
void GraphicsView_ViewPort::fitAll | ( | bool | theKeepScale = false | ) |
References applyTransform(), myCurrentTransform, myFitAllGap, myIsTransforming, and objectsBoundingRect().
void GraphicsView_ViewPort::fitRect | ( | const QRectF & | theRect | ) |
References applyTransform(), and myIsTransforming.
void GraphicsView_ViewPort::fitSelect | ( | ) |
References applyTransform(), initSelected(), moreSelected(), myIsTransforming, nextSelected(), and selectedObject().
void GraphicsView_ViewPort::fitWidth | ( | ) |
References applyTransform(), myFitAllGap, myIsTransforming, and objectsBoundingRect().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
GraphicsView_ObjectList GraphicsView_ViewPort::getObjects | ( | SortType | theSortType = NoSorting | ) | const |
References myObjects, SelectedFirst, and SortByZLevel.
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
bool GraphicsView_ViewPort::hasInteractionFlag | ( | InteractionFlag | theFlag | ) |
References interactionFlags().
|
virtual |
|
private |
References createCursors(), and nCounter.
void GraphicsView_ViewPort::initSelected | ( | ) |
References mySelectionIterator.
int GraphicsView_ViewPort::interactionFlags | ( | ) | const |
References myInteractionFlags.
|
inline |
|
inline |
bool GraphicsView_ViewPort::isItemAdded | ( | QGraphicsItem * | theItem | ) |
bool GraphicsView_ViewPort::isPrepareToSketch | ( | ) |
References myIsPrepareToSketch.
|
inline |
bool GraphicsView_ViewPort::isSelectByRect | ( | ) | const |
References myAreSelectionPointsInitialized.
bool GraphicsView_ViewPort::isSketching | ( | bool * | theIsPath = 0 | ) | const |
References myIsSketching, and myIsSketchingByPath.
|
inline |
bool GraphicsView_ViewPort::moreSelected | ( | ) |
References mySelectionIterator, and nbSelected().
int GraphicsView_ViewPort::nbSelected | ( | ) | const |
References mySelectedObjects.
bool GraphicsView_ViewPort::nextSelected | ( | ) |
References mySelectionIterator, and nbSelected().
QRectF GraphicsView_ViewPort::objectsBoundingRect | ( | bool | theOnlyVisible = false | ) | const |
|
slot |
References hasInteractionFlag(), myScene, mySceneGap, objectsBoundingRect(), and TraceBoundingRect.
|
protectedslot |
References vpContextMenuEvent().
|
protectedslot |
References vpKeyEvent().
|
protectedslot |
References GraphicsView_ViewTransformer::accelKey(), Dragging, DraggingByMiddleButton, dragObjects(), EditFlags, getHighlightedObject(), hasInteractionFlag(), initSelected(), isPulling(), moreSelected(), myDragPosition, myIsDragging, myIsMousePositionEnabled, myStoredCursor, nbSelected(), nextSelected(), selectedObject(), setViewLabelText(), vpMouseEvent(), vpObjectAfterMoving(), and vpObjectBeforeMoving().
|
protectedslot |
References vpWheelEvent().
void GraphicsView_ViewPort::pan | ( | double | theDX, |
double | theDY | ||
) |
void GraphicsView_ViewPort::prepareToSketch | ( | bool | theStatus | ) |
References getSketchCursor(), and myIsPrepareToSketch.
|
inline |
References BS_Dragging, BS_NoBlock, and BS_Selection.
void GraphicsView_ViewPort::removeItem | ( | QGraphicsItem * | theItem | ) |
References myHighlightedObject, myObjects, myScene, mySelectedObjects, and onBoundingRectChanged().
void GraphicsView_ViewPort::reset | ( | ) |
References fitAll().
|
protectedvirtual |
References myViewLabel, and GraphicsView_ViewPort::ViewLabel::setAcceptMoveEvents().
|
virtual |
GraphicsView_Object * GraphicsView_ViewPort::selectedObject | ( | ) |
References mySelectedObjects, mySelectionIterator, and nbSelected().
QRect GraphicsView_ViewPort::selectionRect | ( | ) |
References myAreSelectionPointsInitialized, myFirstSelectionPoint, and myLastSelectionPoint.
void GraphicsView_ViewPort::setBackgroundColor | ( | const QColor & | theColor | ) |
void GraphicsView_ViewPort::setCenter | ( | double | theX, |
double | theY | ||
) |
References applyTransform(), myCurrentTransform, and myIsTransforming.
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 | ) |
References myForegroundFrameColor.
void GraphicsView_ViewPort::setForegroundFrameLineWidth | ( | double | theLineWidth | ) |
References myForegroundFrameLineWidth.
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 |
||
) |
References myInteractionFlags, and setInteractionFlags().
void GraphicsView_ViewPort::setInteractionFlags | ( | InteractionFlags | theFlags | ) |
References myInteractionFlags.
void GraphicsView_ViewPort::setMousePositionEnabled | ( | bool | theState | ) |
References myIsMousePositionEnabled, setViewLabelPosition(), setViewLabelText(), VLP_BottomLeft, and VLP_None.
void GraphicsView_ViewPort::setSceneGap | ( | double | theSceneGap | ) |
References mySceneGap, and onBoundingRectChanged().
void GraphicsView_ViewPort::setSelected | ( | GraphicsView_Object * | theObject | ) |
References mySelectedObjects, and GraphicsView_Object::setSelected().
void GraphicsView_ViewPort::setViewLabelPosition | ( | ViewLabelPosition | thePosition, |
bool | theIsForced = false |
||
) |
References myViewLabel, myViewLabelLayout, VLP_BottomLeft, VLP_BottomRight, VLP_None, VLP_TopLeft, and VLP_TopRight.
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 | ||
) |
References addItem(), myIsSketching, myIsSketchingByPath, mySketchingItem, mySketchingPoint, prepareToSketch(), and SKETCH_Z_VALUE.
void GraphicsView_ViewPort::updateForeground | ( | ) |
void GraphicsView_ViewPort::updateGrid | ( | ) |
References GRID_Z_VALUE, myForegroundSize, myGridCellSize, myGridItem, myGridLineColor, myGridLineStyle, myIsGridEnabled, and myScene.
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
void GraphicsView_ViewPort::zoom | ( | double | theX1, |
double | theY1, | ||
double | theX2, | ||
double | theY2 | ||
) |
References applyTransform(), and myIsTransforming.
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |