How to display an image in QVideoWidget?
Unsolved
General and Desktop
-
I want to add a LOGO image display in QVideoWidget when start-up or stop:
And display cover image of audio file :
QImage imageCover = player->metaData(QMediaMetaData::ThumbnailImage).value<QImage>();
video = new QVideoWidget; connect(player,SIGNAL(stateChanged(QMediaPlayer::State)),SLOT(stateChange(QMediaPlayer::State))); void MainWindow::stateChange(QMediaPlayer::State state) { qDebug() << state; if(state == QMediaPlayer::StoppedState){ video->update(); } }
Start useful, stop useless:
video->setStyleSheet("background-color:blue;");
Useless:
video->setStyleSheet("background-image:url(:/icon.png);");
Useless:
QPalette pal = video->palette(); pal.setBrush(QPalette::Window, QBrush(QPixmap(":/icon.png"))); video->setAutoFillBackground(true); video->setPalette(pal);
-
@sonichy hi,
sadly I'm not well versed with QVideoWidget. But I can tell you what I would attempt to do.Derive QVideoWidget into your own custom class.
Give it a member that can Display an image. e.g QLabel
hook into the resizeEvent and use it to move the Label to the correct spot.
add an image setter and make a logic to hide/show the Label when a video is played or not.