- class QGraphicsVideoItem#
The
QGraphicsVideoItem
class provides a graphics item which display video produced by aQMediaPlayer
orQCamera
. More…Synopsis#
Properties#
aspectRatioModeᅟ
- How a video is scaled to fit the graphics item’s sizenativeSizeᅟ
- The native size of the videooffsetᅟ
- The video item’s offsetsizeᅟ
- The video item’s sizevideoSinkᅟ
- 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:
Methods#
def
__init__()
def
nativeSize()
def
offset()
def
setOffset()
def
setSize()
def
size()
def
videoSink()
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 aQMediaPlayer
orQCamera
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
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property aspectRatioModeᅟ: Qt.AspectRatioMode#
This property holds how a video is scaled to fit the graphics item’s size..
- Access functions:
This property holds the native size of the video..
- Access functions:
Signal
nativeSizeChanged()
This property holds the video item’s offset..
QGraphicsVideoItem
will draw video using the offset for its top left corner.- Access functions:
This property holds the video item’s size..
QGraphicsVideoItem
will draw video scaled to fit size according to its fillMode.- property videoSinkᅟ: 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 toQGraphicsVideoItem
:.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
- Access functions:
- __init__([parent=None])#
- Parameters:
parent –
QGraphicsItem
Constructs a graphics item that displays video.
The
parent
is passed to QGraphicsItem.- aspectRatioMode()#
- Return type:
See also
Getter of property
aspectRatioModeᅟ
.Getter of property
nativeSizeᅟ
.Notification signal of property
nativeSizeᅟ
.- offset()#
- Return type:
See also
Getter of property
offsetᅟ
.- setAspectRatioMode(mode)#
- Parameters:
mode –
AspectRatioMode
See also
Setter of property
aspectRatioModeᅟ
.Setter of property
offsetᅟ
.Setter of property
sizeᅟ
.Getter of property
sizeᅟ
.- videoSink()#
- Return type:
Getter of property
videoSinkᅟ
.