QGraphicsVideoItem#

The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaPlayer or QCamera . More

Inheritance diagram of PySide6.QtMultimediaWidgets.QGraphicsVideoItem

Synopsis#

Properties#

  • aspectRatioMode - How a video is scaled to fit the graphics item’s size

  • nativeSize - The native size of the video

  • offset - The video item’s offset

  • size - The video item’s size

  • videoSink - Returns the underlying video sink that can render video frames to the current item. This property is never nullptr. Example of how to render video frames to QGraphicsVideoItem:

Functions#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

Attaching a QGraphicsVideoItem to a QMediaPlayer or QCamera allows it to display the video or image output of that media object.

player = QMediaPlayer(self)
item = QGraphicsVideoItem()
player.setVideoOutput(item)
graphicsView.scene().addItem(item)
graphicsView.show()
player.setSource(QUrl("http://example.com/myclip4.ogv"))
player.play()

Note: Only a single display output can be attached to a media object at one time.

See also

QMediaPlayer QVideoWidget QCamera

class PySide6.QtMultimediaWidgets.QGraphicsVideoItem([parent=None])#
Parameters:

parentPySide6.QtWidgets.QGraphicsItem

Constructs a graphics item that displays video.

The parent is passed to QGraphicsItem .

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtMultimediaWidgets.QGraphicsVideoItem.aspectRatioMode: AspectRatioMode#

This property holds how a video is scaled to fit the graphics item’s size..

Access functions:
property PᅟySide6.QtMultimediaWidgets.QGraphicsVideoItem.nativeSize: PySide6.QtCore.QSizeF#

This property holds the native size of the video..

Access functions:
property PᅟySide6.QtMultimediaWidgets.QGraphicsVideoItem.offset: PySide6.QtCore.QPointF#

This property holds the video item’s offset..

QGraphicsVideoItem will draw video using the offset for its top left corner.

Access functions:
property PᅟySide6.QtMultimediaWidgets.QGraphicsVideoItem.size: PySide6.QtCore.QSizeF#

This property holds the video item’s size..

QGraphicsVideoItem will draw video scaled to fit size according to its fillMode.

Access functions:
property PᅟySide6.QtMultimediaWidgets.QGraphicsVideoItem.videoSink: PySide6.QtMultimedia.QVideoSink#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

This property holds Returns the underlying video sink that can render video frames to the current item. This property is never nullptr. Example of how to render video frames to QGraphicsVideoItem :.

item = QGraphicsVideoItem()
graphicsView.scene().addItem(item)
graphicsView.show()
img = QImage("images/qt-logo.png").convertToFormat(QImage.Format_ARGB32)
item.videoSink().setVideoFrame(QVideoFrame(img))

See also

setVideoOutput

Access functions:
PySide6.QtMultimediaWidgets.QGraphicsVideoItem.aspectRatioMode()#
Return type:

AspectRatioMode

Getter of property aspectRatioMode .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.nativeSize()#
Return type:

PySide6.QtCore.QSizeF

Getter of property nativeSize .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.nativeSizeChanged(size)#
Parameters:

sizePySide6.QtCore.QSizeF

Notification signal of property nativeSize .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.offset()#
Return type:

PySide6.QtCore.QPointF

See also

setOffset()

Getter of property offset .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setAspectRatioMode(mode)#
Parameters:

modeAspectRatioMode

Setter of property aspectRatioMode .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setOffset(offset)#
Parameters:

offsetPySide6.QtCore.QPointF

See also

offset()

Setter of property offset .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setSize(size)#
Parameters:

sizePySide6.QtCore.QSizeF

See also

size()

Setter of property size .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.size()#
Return type:

PySide6.QtCore.QSizeF

See also

setSize()

Getter of property size .

PySide6.QtMultimediaWidgets.QGraphicsVideoItem.videoSink()#
Return type:

PySide6.QtMultimedia.QVideoSink

Getter of property videoSink .