|
enum | ViewportAnchor { NoAnchor
, AnchorViewCenter
, AnchorUnderMouse
} |
| This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or when the view is transformed. More...
|
|
enum | CacheModeFlag { CacheNone = 0x0
, CacheBackground = 0x1
} |
| This enum describes the flags that you can set for a QGraphicsView's cache mode. More...
|
|
enum | DragMode { NoDrag
, ScrollHandDrag
, RubberBandDrag
} |
| This enum describes the default action for the view when pressing and dragging the mouse over the viewport. More...
|
|
enum | ViewportUpdateMode {
FullViewportUpdate
, MinimalViewportUpdate
, SmartViewportUpdate
, NoViewportUpdate
,
BoundingRectViewportUpdate
} |
|
enum | OptimizationFlag { DontSavePainterState = 0x1
, DontAdjustForAntialiasing = 0x2
, IndirectPainting = 0x4
} |
|
| QGraphicsView (QWidget *parent=nullptr) |
| Constructs a QGraphicsView.
|
|
| QGraphicsView (QGraphicsScene *scene, QWidget *parent=nullptr) |
| Constructs a QGraphicsView and sets the visualized scene to scene.
|
|
| ~QGraphicsView () |
| Destructs the QGraphicsView object.
|
|
QSize | sizeHint () const override |
| \reimp
|
|
QPainter::RenderHints | renderHints () const |
|
void | setRenderHint (QPainter::RenderHint hint, bool enabled=true) |
| If enabled is true, the render hint hint is enabled; otherwise it is disabled.
|
|
void | setRenderHints (QPainter::RenderHints hints) |
|
Qt::Alignment | alignment () const |
|
void | setAlignment (Qt::Alignment alignment) |
|
ViewportAnchor | transformationAnchor () const |
|
void | setTransformationAnchor (ViewportAnchor anchor) |
|
ViewportAnchor | resizeAnchor () const |
|
void | setResizeAnchor (ViewportAnchor anchor) |
|
ViewportUpdateMode | viewportUpdateMode () const |
|
void | setViewportUpdateMode (ViewportUpdateMode mode) |
|
OptimizationFlags | optimizationFlags () const |
|
void | setOptimizationFlag (OptimizationFlag flag, bool enabled=true) |
| Enables flag if enabled is true; otherwise disables flag.
|
|
void | setOptimizationFlags (OptimizationFlags flags) |
|
DragMode | dragMode () const |
|
void | setDragMode (DragMode mode) |
|
CacheMode | cacheMode () const |
|
void | setCacheMode (CacheMode mode) |
|
void | resetCachedContent () |
| Resets any cached content.
|
|
bool | isInteractive () const |
|
void | setInteractive (bool allowed) |
|
QGraphicsScene * | scene () const |
| Returns a pointer to the scene that is currently visualized in the view.
|
|
void | setScene (QGraphicsScene *scene) |
| Sets the current scene to scene.
|
|
QRectF | sceneRect () const |
|
void | setSceneRect (const QRectF &rect) |
|
void | setSceneRect (qreal x, qreal y, qreal w, qreal h) |
|
QTransform | transform () const |
| Returns the current transformation matrix for the view.
|
|
QTransform | viewportTransform () const |
| Returns a matrix that maps scene coordinates to viewport coordinates.
|
|
bool | isTransformed () const |
|
void | setTransform (const QTransform &matrix, bool combine=false) |
| Sets the view's current transformation matrix to matrix.
|
|
void | resetTransform () |
| Resets the view transformation to the identity matrix.
|
|
void | rotate (qreal angle) |
| Rotates the current view transformation angle degrees clockwise.
|
|
void | scale (qreal sx, qreal sy) |
| Scales the current view transformation by (sx, sy).
|
|
void | shear (qreal sh, qreal sv) |
| Shears the current view transformation by (sh, sv).
|
|
void | translate (qreal dx, qreal dy) |
| Translates the current view transformation by (dx, dy).
|
|
void | centerOn (const QPointF &pos) |
| Scrolls the contents of the viewport to ensure that the scene coordinate pos, is centered in the view.
|
|
void | centerOn (qreal x, qreal y) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function is provided for convenience.
|
|
void | centerOn (const QGraphicsItem *item) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Scrolls the contents of the viewport to ensure that item is centered in the view.
|
|
void | ensureVisible (const QRectF &rect, int xmargin=50, int ymargin=50) |
| Scrolls the contents of the viewport so that the scene rectangle rect is visible, with margins specified in pixels by xmargin and ymargin.
|
|
void | ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin=50, int ymargin=50) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function is provided for convenience.
|
|
void | ensureVisible (const QGraphicsItem *item, int xmargin=50, int ymargin=50) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Scrolls the contents of the viewport so that the center of item item is visible, with margins specified in pixels by xmargin and ymargin.
|
|
void | fitInView (const QRectF &rect, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio) |
| Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle rect fits inside the viewport.
|
|
void | fitInView (qreal x, qreal y, qreal w, qreal h, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling fitInView(QRectF(x, y, w, h), aspectRatioMode).
|
|
void | fitInView (const QGraphicsItem *item, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Ensures that item fits tightly inside the view, scaling the view according to aspectRatioMode.
|
|
void | render (QPainter *painter, const QRectF &target=QRectF(), const QRect &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio) |
| Renders the source rect, which is in view coordinates, from the scene into target, which is in paint device coordinates, using painter.
|
|
QList< QGraphicsItem * > | items () const |
| Returns a list of all the items in the associated scene, in descending stacking order (i.e., the first item in the returned list is the uppermost item).
|
|
QList< QGraphicsItem * > | items (const QPoint &pos) const |
| Returns a list of all the items at the position pos in the view.
|
|
QList< QGraphicsItem * > | items (int x, int y) const |
| This function is provided for convenience.
|
|
QList< QGraphicsItem * > | items (const QRect &rect, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list of all the items that, depending on mode, are either contained by or intersect with rect.
|
|
QList< QGraphicsItem * > | items (int x, int y, int w, int h, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
|
QList< QGraphicsItem * > | items (const QPolygon &polygon, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list of all the items that, depending on mode, are either contained by or intersect with polygon.
|
|
QList< QGraphicsItem * > | items (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a list of all the items that, depending on mode, are either contained by or intersect with path.
|
|
QGraphicsItem * | itemAt (const QPoint &pos) const |
| Returns the item at position pos, which is in viewport coordinates.
|
|
QGraphicsItem * | itemAt (int x, int y) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
QPointF | mapToScene (const QPoint &point) const |
| Returns the viewport coordinate point mapped to scene coordinates.
|
|
QPolygonF | mapToScene (const QRect &rect) const |
| Returns the viewport rectangle rect mapped to a scene coordinate polygon.
|
|
QPolygonF | mapToScene (const QPolygon &polygon) const |
| Returns the viewport polygon polygon mapped to a scene coordinate polygon.
|
|
QPainterPath | mapToScene (const QPainterPath &path) const |
| Returns the viewport painter path path mapped to a scene coordinate painter path.
|
|
QPoint | mapFromScene (const QPointF &point) const |
| Returns the scene coordinate point to viewport coordinates.
|
|
QPolygon | mapFromScene (const QRectF &rect) const |
| Returns the scene rectangle rect to a viewport coordinate polygon.
|
|
QPolygon | mapFromScene (const QPolygonF &polygon) const |
| Returns the scene coordinate polygon polygon to a viewport coordinate polygon.
|
|
QPainterPath | mapFromScene (const QPainterPath &path) const |
| Returns the scene coordinate painter path path to a viewport coordinate painter path.
|
|
QPointF | mapToScene (int x, int y) const |
| This function is provided for convenience.
|
|
QPolygonF | mapToScene (int x, int y, int w, int h) const |
| This function is provided for convenience.
|
|
QPoint | mapFromScene (qreal x, qreal y) const |
| This function is provided for convenience.
|
|
QPolygon | mapFromScene (qreal x, qreal y, qreal w, qreal h) const |
| This function is provided for convenience.
|
|
QVariant | inputMethodQuery (Qt::InputMethodQuery query) const override |
| \reimp
|
|
QBrush | backgroundBrush () const |
|
void | setBackgroundBrush (const QBrush &brush) |
|
QBrush | foregroundBrush () const |
|
void | setForegroundBrush (const QBrush &brush) |
|
void | setupViewport (QWidget *widget) override |
| This slot is called by QAbstractScrollArea after setViewport() has been called.
|
|
| QGraphicsView (QGraphicsViewPrivate &, QWidget *parent=nullptr) |
|
bool | event (QEvent *event) override |
| \reimp
|
|
bool | viewportEvent (QEvent *event) override |
| \reimp
|
|
void | contextMenuEvent (QContextMenuEvent *event) override |
| \reimp
|
|
void | focusInEvent (QFocusEvent *event) override |
| \reimp
|
|
bool | focusNextPrevChild (bool next) override |
| \reimp
|
|
void | focusOutEvent (QFocusEvent *event) override |
| \reimp
|
|
void | keyPressEvent (QKeyEvent *event) override |
| \reimp
|
|
void | keyReleaseEvent (QKeyEvent *event) override |
| \reimp
|
|
void | mouseDoubleClickEvent (QMouseEvent *event) override |
| \reimp
|
|
void | mousePressEvent (QMouseEvent *event) override |
| \reimp
|
|
void | mouseMoveEvent (QMouseEvent *event) override |
| \reimp
|
|
void | mouseReleaseEvent (QMouseEvent *event) override |
| \reimp
|
|
void | paintEvent (QPaintEvent *event) override |
| \reimp
|
|
void | resizeEvent (QResizeEvent *event) override |
| \reimp
|
|
void | scrollContentsBy (int dx, int dy) override |
| \reimp
|
|
void | showEvent (QShowEvent *event) override |
| \reimp
|
|
void | inputMethodEvent (QInputMethodEvent *event) override |
| \reimp
|
|
virtual void | drawBackground (QPainter *painter, const QRectF &rect) |
| Draws the background of the scene using painter, before any items and the foreground are drawn.
|
|
virtual void | drawForeground (QPainter *painter, const QRectF &rect) |
| Draws the foreground of the scene using painter, after the background and all items are drawn.
|
|
virtual void | drawItems (QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[]) |
|
QBrush | backgroundBrush |
| the background brush of the scene.
|
|
QBrush | foregroundBrush |
| the foreground brush of the scene.
|
|
bool | interactive |
| whether the view allows scene interaction.
|
|
QRectF | sceneRect |
| the area of the scene visualized by this view.
|
|
Qt::Alignment | alignment |
| the alignment of the scene in the view when the whole scene is visible.
|
|
QPainter::RenderHints | renderHints |
| the default render hints for the view
|
|
DragMode | dragMode |
| the behavior for dragging the mouse over the scene while the left mouse button is pressed.
|
|
CacheMode | cacheMode |
| which parts of the view are cached
|
|
ViewportAnchor | transformationAnchor |
| how the view should position the scene during transformations.
|
|
ViewportAnchor | resizeAnchor |
| how the view should position the scene when the view is resized.
|
|
ViewportUpdateMode | viewportUpdateMode |
| how the viewport should update its contents.
|
|
OptimizationFlags | optimizationFlags |
| flags that can be used to tune QGraphicsView's performance.
|
|