Skip to content

PythonQt.QtGui.QGraphicsView · declarations 002

Back to PythonQt.QtGui.QGraphicsView

fitInView

fitInView(x: Any, y: Any, w: Any, h: Any, aspectRadioMode: Any) -> None

X.fitInView(x, y, w, h, aspectRadioMode)

Supplemental documentation: Qt 5 reference:

void QGraphicsView::fitInView(const QRectF \&rect, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio)

Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle rect fits inside the viewport. rect must be inside the scene rect; otherwise, fitInView() cannot guarantee that the whole rect is visible.

This function keeps the view's rotation, translation, or shear. The view is scaled according to aspectRatioMode. rect will be centered in the view if it does not fit tightly.

It's common to call fitInView() from inside a reimplementation of resizeEvent(), to ensure that the whole scene, or parts of the scene, scales automatically to fit the new size of the viewport as the view is resized. Note though, that calling fitInView() from inside resizeEvent() can lead to unwanted resize recursion, if the new transformation toggles the automatic state of the scrollbars. You can toggle the scrollbar policies to always on or always off to prevent this (see horizontalScrollBarPolicy() and verticalScrollBarPolicy()).

If rect is empty, or if the viewport is too small, this function will do nothing.

See also setTransform(), ensureVisible(), and centerOn().

void QGraphicsView::fitInView(qreal x, qreal y, qreal w, qreal h, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio)

This is an overloaded function.

This convenience function is equivalent to calling fitInView(QRectF(x, y, w, h), aspectRatioMode).

See also ensureVisible() and centerOn().

void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode \= Qt::IgnoreAspectRatio)

This is an overloaded function.

Ensures that item fits tightly inside the view, scaling the view according to aspectRatioMode.

See also ensureVisible() and centerOn().

Upstream PySide2 reference signatures (binding differences may apply):

fitInView(self, item: PySide2.QtWidgets.QGraphicsItem, aspectRadioMode: PySide2.QtCore.Qt.AspectRatioMode=...) -> None
fitInView(self, rect: PySide2.QtCore.QRectF, aspectRadioMode: PySide2.QtCore.Qt.AspectRatioMode=...) -> None
fitInView(self, x: float, y: float, w: float, h: float, aspectRadioMode: PySide2.QtCore.Qt.AspectRatioMode=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#fitInView

focusInEvent

focusInEvent(event: Any) -> None

X.focusInEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::focusInEvent(QFocusEvent *event)

Reimplements: QWidget::focusInEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusInEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#focusInEvent

focusNextPrevChild

focusNextPrevChild(next: bool) -> bool

X.focusNextPrevChild(next) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual protected] bool QGraphicsView::focusNextPrevChild(bool next)

Reimplements: QWidget::focusNextPrevChild(bool next).

Upstream PySide2 reference signatures (binding differences may apply):

focusNextPrevChild(self, next: bool) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#focusNextPrevChild

focusOutEvent

focusOutEvent(event: Any) -> None

X.focusOutEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::focusOutEvent(QFocusEvent *event)

Reimplements: QWidget::focusOutEvent(QFocusEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

focusOutEvent(self, event: PySide2.QtGui.QFocusEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#focusOutEvent

foregroundBrush instance-attribute

foregroundBrush: QBrush

Qt 5 reference:

foregroundBrush : QBrush

This property holds the foreground brush of the scene.

This property sets the foreground brush for the scene in this view. It is used to override the scene's own foreground, and defines the behavior of drawForeground(). To provide custom foreground drawing for this view, you can reimplement drawForeground() instead.

By default, this property contains a brush with the Qt::NoBrush pattern.

Access functions:

QBrush foregroundBrush() const
void setForegroundBrush(const QBrush \&brush)

See also QGraphicsScene::foregroundBrush and backgroundBrush.

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#foregroundBrush

inputMethodEvent

inputMethodEvent(event: Any) -> None

X.inputMethodEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::inputMethodEvent(QInputMethodEvent *event)

Reimplements: QWidget::inputMethodEvent(QInputMethodEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodEvent(self, event: PySide2.QtGui.QInputMethodEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#inputMethodEvent

inputMethodQuery

inputMethodQuery(query: Any) -> Any

X.inputMethodQuery(query) -> object

Supplemental documentation: Qt 5 reference:

[override virtual] QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const

Reimplements: QWidget::inputMethodQuery(Qt::InputMethodQuery query) const.

Upstream PySide2 reference signatures (binding differences may apply):

inputMethodQuery(self, query: PySide2.QtCore.Qt.InputMethodQuery) -> typing.Any

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#inputMethodQuery

interactive instance-attribute

interactive: Any

Qt 5 reference:

interactive : bool

This property holds whether the view allows scene interaction.

If enabled, this view is set to allow scene interaction. Otherwise, this view will not allow interaction, and any mouse or key events are ignored (i.e., it will act as a read-only view).

By default, this property is true.

Access functions:

bool isInteractive() const
void setInteractive(bool allowed)

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#interactive

invalidateScene

invalidateScene(rect: Any, layers: Any) -> None

X.invalidateScene(rect, layers)

Supplemental documentation: Qt 5 reference:

[slot] void QGraphicsView::invalidateScene(const QRectF \&rect \= QRectF(), QGraphicsScene::SceneLayers layers \= QGraphicsScene::AllLayers)

Invalidates and schedules a redraw of layers inside rect. rect is in scene coordinates. Any cached content for layers inside rect is unconditionally invalidated and redrawn.

You can call this function to notify QGraphicsView of changes to the background or the foreground of the scene. It is commonly used for scenes with tile-based backgrounds to notify changes when QGraphicsView has enabled background caching.

Note that QGraphicsView currently supports background caching only (see QGraphicsView::CacheBackground). This function is equivalent to calling update() if any layer but QGraphicsScene::BackgroundLayer is passed.

See also QGraphicsScene::invalidate() and update().

Upstream PySide2 reference signatures (binding differences may apply):

invalidateScene(self, rect: PySide2.QtCore.QRectF=..., layers: PySide2.QtWidgets.QGraphicsScene.SceneLayers=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#invalidateScene

isInteractive

isInteractive() -> bool

X.isInteractive() -> bool

Upstream PySide2 reference signatures (binding differences may apply):

isInteractive(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#isInteractive

isTransformed

isTransformed() -> bool

X.isTransformed() -> bool

Supplemental documentation: Qt 5 reference:

bool QGraphicsView::isTransformed() const

Returns true if the view is transformed (i.e., a non-identity transform has been assigned, or the scrollbars are adjusted).

This function was introduced in Qt 4.6.

See also setTransform(), horizontalScrollBar(), and verticalScrollBar().

Upstream PySide2 reference signatures (binding differences may apply):

isTransformed(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#isTransformed

itemAt

itemAt(x: Any, y: Any) -> Any

X.itemAt(x, y) -> PythonQt.QtGui.QGraphicsItem

Supplemental documentation: Qt 5 reference:

QGraphicsItem *QGraphicsView::itemAt(const QPoint \&pos) const

Returns the item at position pos, which is in viewport coordinates. If there are several items at this position, this function returns the topmost item.

Example:

void CustomView::mousePressEvent(QMouseEvent *event)
{
    if (QGraphicsItem *item = itemAt(event->pos())) {
        qDebug() << "You clicked on item" << item;
    } else {
        qDebug("You didn't click on an item.");
    }
}

See also items() and Sorting.

QGraphicsItem *QGraphicsView::itemAt(int x, int y) const

This is an overloaded function.

This function is provided for convenience. It's equivalent to calling itemAt(QPoint(x, y)).

Upstream PySide2 reference signatures (binding differences may apply):

itemAt(self, pos: PySide2.QtCore.QPoint) -> PySide2.QtWidgets.QGraphicsItem
itemAt(self, x: int, y: int) -> PySide2.QtWidgets.QGraphicsItem

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#itemAt

items

items(x: Any, y: Any, w: Any, h: Any, mode: Any) -> tuple

X.items(x, y, w, h, mode) -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QGraphicsItem *> QGraphicsView::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).

See also QGraphicsScene::items() and Sorting.

QList\<QGraphicsItem *> QGraphicsView::items(const QPoint \&pos) const

Returns a list of all the items at the position pos in the view. The items are listed in descending stacking order (i.e., the first item in the list is the uppermost item, and the last item is the lowermost item). pos is in viewport coordinates.

This function is most commonly called from within mouse event handlers in a subclass in QGraphicsView. pos is in untransformed viewport coordinates, just like QMouseEvent::pos().

void CustomView::mousePressEvent(QMouseEvent *event)
{
    qDebug() << "There are" << items(event->pos()).size()
             << "items at position" << mapToScene(event->pos());
}

See also QGraphicsScene::items() and Sorting.

QList\<QGraphicsItem *> QGraphicsView::items(int x, int y) const

This function is provided for convenience. It's equivalent to calling items(QPoint(x, y)).

QList\<QGraphicsItem *> QGraphicsView::items(const QRect \&rect, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with rect. rect is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by rect are returned.

The items are sorted in descending stacking order (i.e., the first item in the returned list is the uppermost item).

See also itemAt(), items(), mapToScene(), and Sorting.

QList\<QGraphicsItem *> QGraphicsView::items(int x, int y, int w, int h, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

This convenience function is equivalent to calling items(QRectF(x, y, w, h), mode).

This function was introduced in Qt 4.3.

QList\<QGraphicsItem *> QGraphicsView::items(const QPolygon \&polygon, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with polygon. polygon is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by polygon are returned.

The items are sorted by descending stacking order (i.e., the first item in the returned list is the uppermost item).

See also itemAt(), items(), mapToScene(), and Sorting.

QList\<QGraphicsItem *> QGraphicsView::items(const QPainterPath \&path, Qt::ItemSelectionMode mode \= Qt::IntersectsItemShape) const

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with path. path is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by path are returned.

See also itemAt(), items(), mapToScene(), and Sorting.

Upstream PySide2 reference signatures (binding differences may apply):

items(self) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, path: PySide2.QtGui.QPainterPath, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, polygon: PySide2.QtGui.QPolygon, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, pos: PySide2.QtCore.QPoint) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, rect: PySide2.QtCore.QRect, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, x: int, y: int) -> typing.List[PySide2.QtWidgets.QGraphicsItem]
items(self, x: int, y: int, w: int, h: int, mode: PySide2.QtCore.Qt.ItemSelectionMode=...) -> typing.List[PySide2.QtWidgets.QGraphicsItem]

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#items

keyPressEvent

keyPressEvent(event: Any) -> None

X.keyPressEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::keyPressEvent(QKeyEvent *event)

Reimplements: QAbstractScrollArea::keyPressEvent(QKeyEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

keyPressEvent(self, event: PySide2.QtGui.QKeyEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#keyPressEvent

keyReleaseEvent

keyReleaseEvent(event: Any) -> None

X.keyReleaseEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::keyReleaseEvent(QKeyEvent *event)

Reimplements: QWidget::keyReleaseEvent(QKeyEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

keyReleaseEvent(self, event: PySide2.QtGui.QKeyEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#keyReleaseEvent

mapFromScene

mapFromScene(x: Any, y: Any, w: Any, h: Any) -> Any

X.mapFromScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath

Supplemental documentation: Qt 5 reference:

QPoint QGraphicsView::mapFromScene(const QPointF \&point) const

Returns the scene coordinate point to viewport coordinates.

See also mapToScene().

QPolygon QGraphicsView::mapFromScene(const QRectF \&rect) const

Returns the scene rectangle rect to a viewport coordinate polygon.

See also mapToScene().

QPolygon QGraphicsView::mapFromScene(const QPolygonF \&polygon) const

Returns the scene coordinate polygon polygon to a viewport coordinate polygon.

See also mapToScene().

QPainterPath QGraphicsView::mapFromScene(const QPainterPath \&path) const

Returns the scene coordinate painter path path to a viewport coordinate painter path.

See also mapToScene().

QPoint QGraphicsView::mapFromScene(qreal x, qreal y) const

This function is provided for convenience. It's equivalent to calling mapFromScene(QPointF(x, y)).

QPolygon QGraphicsView::mapFromScene(qreal x, qreal y, qreal w, qreal h) const

This function is provided for convenience. It's equivalent to calling mapFromScene(QRectF(x, y, w, h)).

Upstream PySide2 reference signatures (binding differences may apply):

mapFromScene(self, path: PySide2.QtGui.QPainterPath) -> PySide2.QtGui.QPainterPath
mapFromScene(self, point: PySide2.QtCore.QPointF) -> PySide2.QtCore.QPoint
mapFromScene(self, polygon: PySide2.QtGui.QPolygonF) -> PySide2.QtGui.QPolygon
mapFromScene(self, rect: PySide2.QtCore.QRectF) -> PySide2.QtGui.QPolygon
mapFromScene(self, x: float, y: float) -> PySide2.QtCore.QPoint
mapFromScene(self, x: float, y: float, w: float, h: float) -> PySide2.QtGui.QPolygon

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mapFromScene

mapToScene

mapToScene(x: Any, y: Any, w: Any, h: Any) -> Any

X.mapToScene(x, y, w, h) -> PythonQt.QtGui.QPainterPath

Supplemental documentation: Qt 5 reference:

QPointF QGraphicsView::mapToScene(const QPoint \&point) const

Returns the viewport coordinate point mapped to scene coordinates.

Note: It can be useful to map the whole rectangle covered by the pixel at point instead of the point itself. To do this, you can call mapToScene(QRect(point, QSize(2, 2))).

See also mapFromScene().

QPolygonF QGraphicsView::mapToScene(const QRect \&rect) const

Returns the viewport rectangle rect mapped to a scene coordinate polygon.

See also mapFromScene().

QPolygonF QGraphicsView::mapToScene(const QPolygon \&polygon) const

Returns the viewport polygon polygon mapped to a scene coordinate polygon.

See also mapFromScene().

QPainterPath QGraphicsView::mapToScene(const QPainterPath \&path) const

Returns the viewport painter path path mapped to a scene coordinate painter path.

See also mapFromScene().

QPointF QGraphicsView::mapToScene(int x, int y) const

This function is provided for convenience. It's equivalent to calling mapToScene(QPoint(x, y)).

QPolygonF QGraphicsView::mapToScene(int x, int y, int w, int h) const

This function is provided for convenience. It's equivalent to calling mapToScene(QRect(x, y, w, h)).

Upstream PySide2 reference signatures (binding differences may apply):

mapToScene(self, path: PySide2.QtGui.QPainterPath) -> PySide2.QtGui.QPainterPath
mapToScene(self, point: PySide2.QtCore.QPoint) -> PySide2.QtCore.QPointF
mapToScene(self, polygon: PySide2.QtGui.QPolygon) -> PySide2.QtGui.QPolygonF
mapToScene(self, rect: PySide2.QtCore.QRect) -> PySide2.QtGui.QPolygonF
mapToScene(self, x: int, y: int) -> PySide2.QtCore.QPointF
mapToScene(self, x: int, y: int, w: int, h: int) -> PySide2.QtGui.QPolygonF

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mapToScene

matrix

matrix() -> Any

X.matrix() -> PythonQt.QtGui.QMatrix

Upstream PySide2 reference signatures (binding differences may apply):

matrix(self) -> PySide2.QtGui.QMatrix

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#matrix

mouseDoubleClickEvent

mouseDoubleClickEvent(event: Any) -> None

X.mouseDoubleClickEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)

Reimplements: QAbstractScrollArea::mouseDoubleClickEvent(QMouseEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

mouseDoubleClickEvent(self, event: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mouseDoubleClickEvent

mouseMoveEvent

mouseMoveEvent(event: Any) -> None

X.mouseMoveEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::mouseMoveEvent(QMouseEvent *event)

Reimplements: QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

mouseMoveEvent(self, event: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mouseMoveEvent

mousePressEvent

mousePressEvent(event: Any) -> None

X.mousePressEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::mousePressEvent(QMouseEvent *event)

Reimplements: QAbstractScrollArea::mousePressEvent(QMouseEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

mousePressEvent(self, event: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mousePressEvent

mouseReleaseEvent

mouseReleaseEvent(event: Any) -> None

X.mouseReleaseEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)

Reimplements: QAbstractScrollArea::mouseReleaseEvent(QMouseEvent *e).

Upstream PySide2 reference signatures (binding differences may apply):

mouseReleaseEvent(self, event: PySide2.QtGui.QMouseEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#mouseReleaseEvent

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QGraphicsView.objectNameChanged; argument details are not documented.

optimizationFlags instance-attribute

optimizationFlags: Any

Qt 5 reference:

optimizationFlags : OptimizationFlags

flags that can be used to tune QGraphicsView's performance.

QGraphicsView uses clipping, extra bounding rect adjustments, and certain other aids to improve rendering quality and performance for the common case graphics scene. However, depending on the target platform, the scene, and the viewport in use, some of these operations can degrade performance.

The effect varies from flag to flag; see the OptimizationFlags documentation for details.

By default, no optimization flags are enabled.

This property was introduced in Qt 4.3.

Access functions:

QGraphicsView::OptimizationFlags optimizationFlags() const
void setOptimizationFlags(QGraphicsView::OptimizationFlags flags)

See also setOptimizationFlag().

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#optimizationFlags

paintEvent

paintEvent(event: Any) -> None

X.paintEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::paintEvent(QPaintEvent *event)

Reimplements: QAbstractScrollArea::paintEvent(QPaintEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

paintEvent(self, event: PySide2.QtGui.QPaintEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#paintEvent

render

render(painter: Any, target: Any, source: Any, aspectRatioMode: Any) -> None

X.render(painter, target, source, aspectRatioMode)

Supplemental documentation: Qt 5 reference:

void QGraphicsView::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. This function is useful for capturing the contents of the view onto a paint device, such as a QImage (e.g., to take a screenshot), or for printing to QPrinter. For example:

QGraphicsScene scene;
scene.addItem(...
...

QGraphicsView view(&scene);
view.show();
...

QPrinter printer(QPrinter::HighResolution);
printer.setPageSize(QPrinter::A4);
QPainter painter(&printer);

// print, fitting the viewport contents into a full page
view.render(&painter);

// print the upper half of the viewport into the lower.
// half of the page.
QRect viewport = view.viewport()->rect();
view.render(&painter,
            QRectF(0, printer.height() / 2,
                   printer.width(), printer.height() / 2),
            viewport.adjusted(0, 0, 0, -viewport.height() / 2));

If source is a null rect, this function will use viewport()->rect() to determine what to draw. If target is a null rect, the full dimensions of painter's paint device (e.g., for a QPrinter, the page size) will be used.

The source rect contents will be transformed according to aspectRatioMode to fit into the target rect. By default, the aspect ratio is kept, and source is scaled to fit in target.

See also QGraphicsScene::render().

Upstream PySide2 reference signatures (binding differences may apply):

render(self, painter: PySide2.QtGui.QPainter, target: PySide2.QtCore.QRectF=..., source: PySide2.QtCore.QRect=..., aspectRatioMode: PySide2.QtCore.Qt.AspectRatioMode=...) -> None
render(self, target: PySide2.QtGui.QPaintDevice, targetOffset: PySide2.QtCore.QPoint=..., sourceRegion: PySide2.QtGui.QRegion=..., renderFlags: PySide2.QtWidgets.QWidget.RenderFlags=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#render

renderHints instance-attribute

renderHints: Any

Qt 5 reference:

renderHints : QPainter::RenderHints

This property holds the default render hints for the view

These hints are used to initialize QPainter before each visible item is drawn. QPainter uses render hints to toggle rendering features such as antialiasing and smooth pixmap transformation.

QPainter::TextAntialiasing is enabled by default.

Example:

QGraphicsScene scene;
scene.addRect(QRectF(-10, -10, 20, 20));

QGraphicsView view(&scene);
view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
view.show();

Access functions:

QPainter::RenderHints renderHints() const
void setRenderHints(QPainter::RenderHints hints)

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#renderHints

resetCachedContent

resetCachedContent() -> None

X.resetCachedContent()

Supplemental documentation: Qt 5 reference:

void QGraphicsView::resetCachedContent()

Resets any cached content. Calling this function will clear QGraphicsView's cache. If the current cache mode is CacheNone, this function does nothing.

This function is called automatically for you when the backgroundBrush or QGraphicsScene::backgroundBrush properties change; you only need to call this function if you have reimplemented QGraphicsScene::drawBackground() or QGraphicsView::drawBackground() to draw a custom background, and need to trigger a full redraw.

See also cacheMode().

Upstream PySide2 reference signatures (binding differences may apply):

resetCachedContent(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#resetCachedContent

resetMatrix

resetMatrix() -> None

X.resetMatrix()

Upstream PySide2 reference signatures (binding differences may apply):

resetMatrix(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#resetMatrix

resetTransform

resetTransform() -> None

X.resetTransform()

Supplemental documentation: Qt 5 reference:

void QGraphicsView::resetTransform()

Resets the view transformation to the identity matrix.

See also transform() and setTransform().

Upstream PySide2 reference signatures (binding differences may apply):

resetTransform(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#resetTransform

resizeAnchor instance-attribute

resizeAnchor: Any

Qt 5 reference:

resizeAnchor : ViewportAnchor

how the view should position the scene when the view is resized.

QGraphicsView uses this property to decide how to position the scene in the viewport when the viewport widget's size changes. The default behavior, NoAnchor, leaves the scene's position unchanged during a resize; the top-left corner of the view will appear to be anchored while resizing.

Note that the effect of this property is noticeable when only a part of the scene is visible (i.e., when there are scroll bars). Otherwise, if the whole scene fits in the view, QGraphicsScene uses the view alignment to position the scene in the view.

Access functions:

QGraphicsView::ViewportAnchor resizeAnchor() const
void setResizeAnchor(QGraphicsView::ViewportAnchor anchor)

See also alignment and transformationAnchor.

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#resizeAnchor

resizeEvent

resizeEvent(event: Any) -> None

X.resizeEvent(event)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::resizeEvent(QResizeEvent *event)

Reimplements: QAbstractScrollArea::resizeEvent(QResizeEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

resizeEvent(self, event: PySide2.QtGui.QResizeEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#resizeEvent

rotate

rotate(angle: float) -> None

X.rotate(angle)

Supplemental documentation: Qt 5 reference:

void QGraphicsView::rotate(qreal angle)

Rotates the current view transformation angle degrees clockwise.

See also setTransform(), transform(), scale(), shear(), and translate().

Upstream PySide2 reference signatures (binding differences may apply):

rotate(self, angle: float) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#rotate

rubberBandChanged

rubberBandChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QGraphicsView.rubberBandChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QGraphicsView::rubberBandChanged(QRect rubberBandRect, QPointF fromScenePoint, QPointF toScenePoint)

This signal is emitted when the rubber band rect is changed. The viewport Rect is specified by rubberBandRect. The drag start position and drag end position are provided in scene points with fromScenePoint and toScenePoint.

When rubberband selection ends this signal will be emitted with null vales.

This function was introduced in Qt 5.1.

See also rubberBandRect().

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#rubberBandChanged

rubberBandRect

rubberBandRect() -> Any

X.rubberBandRect() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRect QGraphicsView::rubberBandRect() const

This functions returns the current rubber band area (in viewport coordinates) if the user is currently doing an itemselection with rubber band. When the user is not using the rubber band this functions returns (a null) QRectF().

Notice that part of this QRect can be outise the visual viewport. It can e.g contain negative values.

This function was introduced in Qt 5.1.

See also rubberBandSelectionMode and rubberBandChanged().

Upstream PySide2 reference signatures (binding differences may apply):

rubberBandRect(self) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#rubberBandRect

rubberBandSelectionMode instance-attribute

rubberBandSelectionMode: Any

Qt 5 reference:

rubberBandSelectionMode : Qt::ItemSelectionMode

This property holds the behavior for selecting items with a rubber band selection rectangle.

This property defines how items are selected when using the RubberBandDrag drag mode.

The default value is Qt::IntersectsItemShape; all items whose shape intersects with or is contained by the rubber band are selected.

This property was introduced in Qt 4.3.

Access functions:

Qt::ItemSelectionMode rubberBandSelectionMode() const
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode)

See also dragMode, items(), and rubberBandRect().

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#rubberBandSelectionMode

scale

scale(sx: float, sy: float) -> None

X.scale(sx, sy)

Supplemental documentation: Qt 5 reference:

void QGraphicsView::scale(qreal sx, qreal sy)

Scales the current view transformation by (sx, sy).

See also setTransform(), transform(), rotate(), shear(), and translate().

Upstream PySide2 reference signatures (binding differences may apply):

scale(self, sx: float, sy: float) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#scale

scene

scene() -> Any

X.scene() -> PythonQt.QtGui.QGraphicsScene

Supplemental documentation: Qt 5 reference:

QGraphicsScene *QGraphicsView::scene() const

Returns a pointer to the scene that is currently visualized in the view. If no scene is currently visualized, nullptr is returned.

See also setScene().

Upstream PySide2 reference signatures (binding differences may apply):

scene(self) -> PySide2.QtWidgets.QGraphicsScene

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#scene

sceneRect instance-attribute

sceneRect: QRectF

Qt 5 reference:

sceneRect : QRectF

This property holds the area of the scene visualized by this view.

The scene rectangle defines the extent of the scene, and in the view's case, this means the area of the scene that you can navigate using the scroll bars.

If unset, or if a null QRectF is set, this property has the same value as QGraphicsScene::sceneRect, and it changes with QGraphicsScene::sceneRect. Otherwise, the view's scene rect is unaffected by the scene.

Note that, although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX). When the scene is larger than the scroll bars' values, you can choose to use translate() to navigate the scene instead.

By default, this property contains a rectangle at the origin with zero width and height.

Access functions:

QRectF sceneRect() const
void setSceneRect(const QRectF \&rect)
void setSceneRect(qreal x, qreal y, qreal w, qreal h)

See also QGraphicsScene::sceneRect.

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#sceneRect

scrollContentsBy

scrollContentsBy(dx: int, dy: int) -> None

X.scrollContentsBy(dx, dy)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QGraphicsView::scrollContentsBy(int dx, int dy)

Reimplements: QAbstractScrollArea::scrollContentsBy(int dx, int dy).

Upstream PySide2 reference signatures (binding differences may apply):

scrollContentsBy(self, dx: int, dy: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qgraphicsview.html#scrollContentsBy