QGraphicsVideoItem Class
The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. 更多...
头文件: | #include <QGraphicsVideoItem> |
qmake: | QT += multimediawidgets |
基类: | QGraphicsObject and QMediaBindableInterface |
属性
|
- 12 个属性继承自 QGraphicsObject
公有函数
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 |
- 2 个公有函数继承自 QGraphicsObject
- 1 个公有函数继承自 QMediaBindableInterface
- 176 个公有函数继承自 QGraphicsItem
信号
void | nativeSizeChanged(const QSizeF &size) |
- 9 个信号继承自 QGraphicsObject
其他继承的成员
- 2 个公有变量继承自 QGraphicsItem
- 1 个受保护的函数继承自 QGraphicsObject
- 1 个受保护的函数继承自 QMediaBindableInterface
- 24 个受保护的函数继承自 QGraphicsItem
- 1 个受保护的槽函数继承自 QGraphicsObject
- 1 protected type inherited from QGraphicsItem
详细描述
The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
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->setVideoOutput(item); graphicsView->scene()->addItem(item); graphicsView->show(); player->setMedia(QUrl("http://example.com/myclip4.ogv")); player->play();
Note: Only a single display output can be attached to a media object at one time.
参见 QMediaObject, QMediaPlayer, and QVideoWidget.
属性
aspectRatioMode : Qt::AspectRatioMode
how a video is scaled to fit the graphics item's size.
访问函数:
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
This property holds the native size of the video.
访问函数:
QSizeF | nativeSize() const |
Notifier signal:
void | nativeSizeChanged(const QSizeF &size) |
offset : QPointF
This property holds the video item's offset.
QGraphicsVideoItem will draw video using the offset for its top left corner.
访问函数:
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)
Constructs a graphics item that displays video.
The parent is passed to QGraphicsItem.
QGraphicsVideoItem::~QGraphicsVideoItem()
Destroys a video graphics item.
[override virtual]
QRectF QGraphicsVideoItem::boundingRect() const
Reimplemented from QGraphicsItem::boundingRect().
[signal]
void QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size)
Signals that the native size of the video has changed.
Note: Notifier signal for property nativeSize.
[override virtual]
void QGraphicsVideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR)
Reimplemented from QGraphicsItem::paint().