QGraphicsVideoItem 类

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 .

特性文档编制

aspectRatioMode : Qt::AspectRatioMode

如何比例缩放视频以拟合图形项的大小。

访问函数:

Qt::AspectRatioMode aspectRatioMode () const
void setAspectRatioMode (Qt::AspectRatioMode mode )

mediaObject : QMediaObject * const

This property holds the media object which provides the video displayed by a graphics item.

访问函数:

virtual QMediaObject * mediaObject () const override

nativeSize : const QSizeF

此特性保持视频的本机大小。

访问函数:

QSizeF nativeSize () const

通知程序信号:

void nativeSizeChanged (const QSizeF & size )

offset : QPointF

此特性保持视频项的偏移。

QGraphicsVideoItem 将使用其左上角的偏移绘制视频。

访问函数:

QPointF offset () const
void setOffset (const QPointF & offset )

size : QSizeF

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 )

成员函数文档编制

QGraphicsVideoItem:: QGraphicsVideoItem ( QGraphicsItem * parent = Q_NULLPTR)

构造显示视频的图形项。

The parent 会被传递给 QGraphicsItem .

QGraphicsVideoItem:: ~QGraphicsVideoItem ()

销毁视频图形项。

[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 ().