QGraphicsVideoItem Class▲
-
Header: QGraphicsVideoItem
-
qmake: QT += multimediawidgets
-
Inherits: QGraphicsObject and QMediaBindableInterface
-
Group: QGraphicsVideoItem is part of multimedia
Detailed Description▲
Attaching a QGraphicsVideoItem to a QMediaObject allows it to display the video or image output of that media object. A QGraphicsVideoItem is attached to a media object by passing a pointer to the QMediaObject to the setMediaObject() function.
player =
new
QMediaPlayer(this
);
QGraphicsVideoItem *
item =
new
QGraphicsVideoItem;
player-&
gt;setVideoOutput(item);
graphicsView-&
gt;scene()-&
gt;addItem(item);
graphicsView-&
gt;show();
player-&
gt;setMedia(QUrl("http://example.com/myclip4.ogv"
));
player-&
gt;play();
Note: Only a single display output can be attached to a media object at one time.
See Also▲
See also QMediaObject, QMediaPlayer, QVideoWidget
Property Documentation▲
aspectRatioMode : Qt::AspectRatioMode▲
how a video is scaled to fit the graphics item's size.
Access functions:
-
aspectRatioMode() const
-
void setAspectRatioMode( mode)
mediaObject : QMediaObject* const▲
This property holds the media object which provides the video displayed by a graphics item.
Access functions:
-
virtual *mediaObject() const override
[read-only] nativeSize : const QSizeF▲
This property holds the native size of the video.
Access functions:
-
nativeSize() const
Notifier signal:
-
void nativeSizeChanged(const &size)
offset : QPointF▲
This property holds the video item's offset.
QGraphicsVideoItem will draw video using the offset for its top left corner.
Access functions:
-
offset() const
-
void setOffset(const &offset)
size : QSizeF▲
This property holds the video item's size.
QGraphicsVideoItem will draw video scaled to fit size according to its fillMode.
Access functions:
-
size() const
-
void setSize(const &size)
Member Function Documentation▲
[explicit] QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent = nullptr)▲
Constructs a graphics item that displays video.
The parent is passed to QGraphicsItem.
[virtual] QGraphicsVideoItem::~QGraphicsVideoItem()▲
Destroys a video graphics item.
[override virtual] QRectF QGraphicsVideoItem::boundingRect() const▲
Reimplements: QGraphicsItem::boundingRect() const.
void QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size)▲
Signals that the native size of the video has changed.
Notifier signal for property nativeSize.