【发布时间】:2019-08-02 07:35:26
【问题描述】:
我尝试使用 QGraphicView 显示视频,但我的代码没有显示任何内容。有什么问题
QGraphicsScene scene;
QGraphicsVideoItem *item1 = new QGraphicsVideoItem;
item1->setPos(0,100);
QMediaPlayer * player1 = new QMediaPlayer;
player1->setVideoOutput(item1);
player1->setMedia(QUrl("/home/1.wmv"));
QGraphicsView view;
view.scale(0.3,0.3);
view.setScene(&scene);
view.show();
player1->play();
【问题讨论】:
-
更改为
QGraphicsScene *scene = new QGraphicsScene;和QGraphicsView *view = new QGraphicsView(scene);,提供minimal reproducible example