QGraphicsVideoItem Class
QGraphicsVideoItem 클래스는 QMediaPlayer 또는 QCamera 에서 생성된 동영상을 표시하는 그래픽 항목을 제공합니다. 더 보기...
| 헤더: | #include <qgraphicsvideoitem.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS MultimediaWidgets) target_link_libraries(mytarget PRIVATE Qt6::MultimediaWidgets) |
| qmake: | QT += multimediawidgets |
| 상속: | QGraphicsObject |
속성
|
공개 함수
| QGraphicsVideoItem(QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsVideoItem() override |
| 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 |
| QVideoSink * | videoSink() const |
재구현된 공용 함수
| virtual QRectF | boundingRect() const override |
| virtual void | paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override |
| virtual int | type() const override |
신호
| void | nativeSizeChanged(const QSizeF &size) |
상세 설명
QGraphicsVideoItem을 QMediaPlayer 또는 QCamera 에 연결하면 해당 미디어 객체의 비디오 또는 이미지 출력을 표시할 수 있습니다.
player = new QMediaPlayer(this);
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
graphicsView->scene()->addItem(item);
graphicsView->show();
player->setSource(QUrl("http://example.com/myclip4.ogv"));
player->play();참고: 한 번에 하나의 디스플레이 출력만 미디어 객체에 연결할 수 있습니다.
QMediaPlayer, QVideoWidget 및 QCamera도 참조하십시오 .
속성 설명서
aspectRatioMode : Qt::AspectRatioMode
비디오가 그래픽 항목의 크기에 맞게 어떻게 조정되는지.
사용 가능한 함수:
| Qt::AspectRatioMode | aspectRatioMode() const |
| void | setAspectRatioMode(Qt::AspectRatioMode mode) |
[read-only] nativeSize : QSizeF
이 속성은 동영상의 원본 크기를 저장합니다.
액세스 함수:
| QSizeF | nativeSize() const |
알림 신호:
| void | nativeSizeChanged(const QSizeF &size) |
offset : QPointF
이 속성은 비디오 항목의 오프셋을 저장합니다.
QGraphicsVideoItem 동영상의 왼쪽 상단 모서리에 대한 오프셋을 사용하여 동영상을 렌더링합니다.
액세스 함수:
| QPointF | offset() const |
| void | setOffset(const QPointF &offset) |
size : QSizeF
이 속성은 비디오 항목의 크기를 저장합니다.
QGraphicsVideoItem fillMode에 따라 크기에 맞게 크기가 조정된 비디오를 렌더링합니다.
액세스 함수:
| QSizeF | size() const |
| void | setSize(const QSizeF &size) |
[read-only] videoSink : QVideoSink* const
현재 항목에 비디오 프레임을 렌더링할 수 있는 기본 비디오 싱크를 반환합니다. 이 속성은 절대 ` nullptr`가 되지 않습니다. ` QGraphicsVideoItem`에 비디오 프레임을 렌더링하는 방법의 예시:
QGraphicsVideoItem *item = new QGraphicsVideoItem;
graphicsView->scene()->addItem(item);
graphicsView->show();
QImage img = QImage("images/qt-logo.png").convertToFormat(QImage::Format_ARGB32);
item->videoSink()->setVideoFrame(QVideoFrame(img));액세스 함수:
| QVideoSink * | videoSink() const | [see note below] |
참고: 이 함수는 메타 객체 시스템 및 QML을 통해 호출할 수 있습니다. Q_INVOKABLE 를 참조하십시오.
QMediaPlayer::setVideoOutput도 참조하십시오 .
멤버 함수 문서
[explicit] QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent = nullptr)
비디오를 표시하는 그래픽 항목을 생성합니다.
parent 가 QGraphicsItem 에 전달됩니다.
[override virtual noexcept] QGraphicsVideoItem::~QGraphicsVideoItem()
비디오 그래픽 항목을 삭제합니다.
[override virtual] QRectF QGraphicsVideoItem::boundingRect() const
QGraphicsItem::boundingRect() const를 재구현합니다.
[override virtual] void QGraphicsVideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)를 재구현합니다.
[override virtual] int QGraphicsVideoItem::type() const
QGraphicsItem::type() const를 재구현합니다.
비디오 항목의 유형을 나타내는 int 값을 반환합니다.
© 2026 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.