QGraphicsVideoItem Class
QGraphicsVideoItem 클래스는 QMediaPlayer 또는 QCamera 에서 생성된 비디오를 표시하는 그래픽 항목을 제공합니다... .
헤더: | #include <QGraphicsVideoItem> |
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 : const QSizeF
이 속성은 동영상의 기본 크기를 유지합니다.
액세스 함수:
QSizeF | nativeSize() const |
알림 신호:
void | nativeSizeChanged(const QSizeF &size) |
offset : QPointF
이 속성은 비디오 항목의 오프셋을 보유합니다.
QGraphicsVideoItem 는 왼쪽 상단 모서리의 오프셋을 사용하여 비디오를 그립니다.
함수에 액세스합니다:
QPointF | offset() const |
void | setOffset(const QPointF &offset) |
size : QSizeF
이 속성은 동영상 항목의 크기를 저장합니다.
QGraphicsVideoItem 채우기 모드에 따라 크기에 맞게 크기가 조정된 동영상을 그립니다.
함수에 액세스합니다:
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 *페인터, const Q스타일옵션그래픽아이템 *옵션, Q위젯 *위젯).
[override virtual]
int QGraphicsVideoItem::type() const
재구현합니다: QGraphicsItem::type() const.
동영상 항목의 유형을 나타내는 int를 리턴합니다.
© 2025 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.