resize the video according to my controls widget
-
I want all the videos to display with the same size as my widget or my label, (both of them have the same size), and remove the black border.
here is my code:
void ViewMedia::playMedia() { if(!_listMedia.isEmpty()) { Contexthelp contexthelp = _listMedia.first(); QByteArray imageFormat = QImageReader::imageFormat(contexthelp.getMedia()); if(!imageFormat.isEmpty()) // media is image { _label->setPixmap(contexthelp.getMedia()); _label->setScaledContents(true); _layout->addWidget(_label); _widget->setLayout(_layout); QTimer::singleShot(1000, this, &ViewMedia::playNext); } else // media is video { _label->clear(); _player->setVideoOutput(_videowidget); _player->setMedia(QUrl::fromLocalFile(contexthelp.getMedia())); // video path _layout->addWidget(_videowidget); // _videowidget->setFixedHeight(_widget->height()); // I tried to fix the size of the video but it did not work // _videowidget->setFixedWidth(_widget->width()); _player->play(); connect(_player, &QMediaPlayer::stateChanged, this, &ViewMedia::stateChanged); // Check video statement connect(_player, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error),[=] // QMediaplayer error occured (QMediaPlayer::Error error){ qInfo()<< "error occured media player : " << error; }); } } else { qDebug()<< "listMedia is empty"; downloadContexthelp(); } }
-
Hi and welcome to devnet,
Are these lines you want to remove part of the original video ?
Are you using layouts ? -
Hi and welcome to devnet,
Are these lines you want to remove part of the original video ?
Are you using layouts ? -
Then please show how you setup your GUI.