QGraphicsVideoItem¶
The QGraphicsVideoItem
class provides a graphics item which display video produced by a QMediaPlayer
or QCamera
. More…
Synopsis¶
Functions¶
def
aspectRatioMode
()def
nativeSize
()def
offset
()def
setAspectRatioMode
(mode)def
setOffset
(offset)def
setSize
(size)def
size
()def
videoSink
()
Signals¶
def
nativeSizeChanged
(size)
Detailed Description¶
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
parent –
PySide6.QtWidgets.QGraphicsItem
Constructs a graphics item that displays video.
The parent
is passed to QGraphicsItem
.
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.aspectRatioMode()¶
- Return type
This property holds how a video is scaled to fit the graphics item’s size..
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.nativeSize()¶
- Return type
This property holds the native size of the video..
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.nativeSizeChanged(size)¶
- Parameters
size –
PySide6.QtCore.QSizeF
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.offset()¶
- Return type
This property holds the video item’s offset..
QGraphicsVideoItem
will draw video using the offset for its top left corner.
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setAspectRatioMode(mode)¶
- Parameters
mode –
AspectRatioMode
This property holds how a video is scaled to fit the graphics item’s size..
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setOffset(offset)¶
- Parameters
offset –
PySide6.QtCore.QPointF
This property holds the video item’s offset..
QGraphicsVideoItem
will draw video using the offset for its top left corner.
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.setSize(size)¶
- Parameters
size –
PySide6.QtCore.QSizeF
This property holds the video item’s size..
QGraphicsVideoItem
will draw video scaled to fit size according to its fillMode.
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.size()¶
- Return type
This property holds the video item’s size..
QGraphicsVideoItem
will draw video scaled to fit size according to its fillMode.
- PySide6.QtMultimediaWidgets.QGraphicsVideoItem.videoSink()¶
- Return type
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
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.