The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject . 更多...
头: | #include <QGraphicsVideoItem> |
qmake: | QT += multimediawidgets |
继承: | QGraphicsObject and QMediaBindableInterface |
|
QGraphicsVideoItem (QGraphicsItem * parent = Q_NULLPTR) | |
~QGraphicsVideoItem () | |
Qt::AspectRatioMode | aspectRatioMode () const |
QSizeF | nativeSize () const |
QPointF | offset () const |
void | setAspectRatioMode (Qt::AspectRatioMode mode ) |
void | setOffset (const QPointF & offset ) |
void | setSize (const QSizeF & size ) |
QSizeF | size () const |
virtual QRectF | boundingRect () const override |
virtual QMediaObject * | mediaObject () const override |
virtual void | paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR) override |
void | nativeSizeChanged (const QSizeF & size ) |
The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject .
Attaching a QGraphicsVideoItem 到 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 到 setMediaObject () 函数。
player = new QMediaPlayer(this); QGraphicsVideoItem *item = new QGraphicsVideoItem; player->setVideoOutput(item); graphicsView->scene()->addItem(item); graphicsView->show(); player->setMedia(QUrl("http://example.com/myclip4.ogv")); player->play();
注意 :每次只可以把单个显示输出附加到媒体对象。
另请参阅 QMediaObject , QMediaPlayer ,和 QVideoWidget .
如何比例缩放视频以拟合图形项的大小。
访问函数:
Qt::AspectRatioMode | aspectRatioMode () const |
void | setAspectRatioMode (Qt::AspectRatioMode mode ) |
This property holds the media object which provides the video displayed by a graphics item.
访问函数:
virtual QMediaObject * | mediaObject () const override |
此特性保持视频的本机大小。
访问函数:
QSizeF | nativeSize () const |
通知程序信号:
void | nativeSizeChanged (const QSizeF & size ) |
此特性保持视频项的偏移。
QGraphicsVideoItem 将使用其左上角的偏移绘制视频。
访问函数:
QPointF | offset () const |
void | setOffset (const QPointF & offset ) |
This property holds the video item's size.
QGraphicsVideoItem will draw video scaled to fit size according to its fillMode.
访问函数:
QSizeF | size () const |
void | setSize (const QSizeF & size ) |
构造显示视频的图形项。
The parent 会被传递给 QGraphicsItem .
销毁视频图形项。
[override virtual]
QRectF
QGraphicsVideoItem::
boundingRect
() const
重实现自 QGraphicsItem::boundingRect ().
[signal]
void
QGraphicsVideoItem::
nativeSizeChanged
(const
QSizeF
&
size
)
发射信号当本机 size 对于视频已改变。
注意: 通知程序信号对于特性 nativeSize .
[override virtual]
void
QGraphicsVideoItem::
paint
(
QPainter
*
painter
, const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
= Q_NULLPTR)
重实现自 QGraphicsItem::paint ().