Exit video full-screen
-
@mrjj this is how it shows :
@HW-Developer
Super, i really think its just because your are not assigning a parent when you create it.
it then becomes a window.
So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
Thats easy fixed by assigning a parent.
Did you based this off some sample i can look at ? -
@HW-Developer
Super, i really think its just because your are not assigning a parent when you create it.
it then becomes a window.
So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
Thats easy fixed by assigning a parent.
Did you based this off some sample i can look at ?@mrjj I make you a simple example, it shows the same issue:
#include "MyPlayer.h" MyPlayer::MyPlayer(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); QWidget *zoneCentrale = new QWidget; setCentralWidget(zoneCentrale); player = new QMediaPlayer(this); videoWidget = new MyVideoWidget(this); videoWidget->setGeometry(100, 100, 500, 400); fullScreen = new QPushButton("full-screen", this); layout = new QVBoxLayout(); player->setMedia(QUrl::fromLocalFile("C:/Users/ouafa/Downloads/nature.mp4")); player->setVideoOutput(videoWidget); layout->addWidget(videoWidget); layout->addWidget(fullScreen); zoneCentrale->setLayout(layout); player->setVolume(100); setCentralWidget(zoneCentrale); QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked())); videoWidget->show(); player->play(); qDebug()<< player->isVideoAvailable(); qDebug() << player->availableMetaData() << player->currentMedia().canonicalUrl(); } void MyPlayer::on_bt_agrandi_clicked() { if (!videoWidget->isFullScreen()) { videoWidget->setFullScreen(true); } qDebug() << "hi there!"; }
-
Hi
I could not reproduce
However, using you code 100% as is - made app crash. Not sure why.
(just tried again to be sure)This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
else its pretty much the same. Can you try this ? ( change the mp4 file ofc)QWidget* zoneCentrale = new QWidget; setCentralWidget(zoneCentrale); auto player = new QMediaPlayer(this); auto videoWidget = new QVideoWidget(this); player->setVideoOutput(videoWidget); auto fullScreen = new QPushButton("full-screen", this); auto layout = new QVBoxLayout(zoneCentrale); player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4")); layout->addWidget(videoWidget); layout->addWidget(fullScreen); player->setVolume(100); QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked())); videoWidget->show(); player->play();
-
Hi
I could not reproduce
However, using you code 100% as is - made app crash. Not sure why.
(just tried again to be sure)This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
else its pretty much the same. Can you try this ? ( change the mp4 file ofc)QWidget* zoneCentrale = new QWidget; setCentralWidget(zoneCentrale); auto player = new QMediaPlayer(this); auto videoWidget = new QVideoWidget(this); player->setVideoOutput(videoWidget); auto fullScreen = new QPushButton("full-screen", this); auto layout = new QVBoxLayout(zoneCentrale); player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4")); layout->addWidget(videoWidget); layout->addWidget(fullScreen); player->setVolume(100); QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked())); videoWidget->show(); player->play();
@mrjj It's not working, when i make the changes, i run the app and click fullscreen button, it crash, and it blocks the app
-
Hi
I could not reproduce
However, using you code 100% as is - made app crash. Not sure why.
(just tried again to be sure)This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
else its pretty much the same. Can you try this ? ( change the mp4 file ofc)QWidget* zoneCentrale = new QWidget; setCentralWidget(zoneCentrale); auto player = new QMediaPlayer(this); auto videoWidget = new QVideoWidget(this); player->setVideoOutput(videoWidget); auto fullScreen = new QPushButton("full-screen", this); auto layout = new QVBoxLayout(zoneCentrale); player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4")); layout->addWidget(videoWidget); layout->addWidget(fullScreen); player->setVolume(100); QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked())); videoWidget->show(); player->play();
@mrjj It's working after i verify everything, it is the escape key event, it should be setFullScreen(False) instead of showNormal();
I really thank you for your help. It was really nice
Good luck and have a good days -
@mrjj It's working after i verify everything, it is the escape key event, it should be setFullScreen(False) instead of showNormal();
I really thank you for your help. It was really nice
Good luck and have a good days@HW-Developer
Super.
Happy days to you too -
@HW-Developer
Super, i really think its just because your are not assigning a parent when you create it.
it then becomes a window.
So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
Thats easy fixed by assigning a parent.
Did you based this off some sample i can look at ? -
@RakeshChitte
Hi
Issue exiting fullscreen or floating window ? -
@RakeshChitte
Hi
Issue exiting fullscreen or floating window ?@mrjj
existing full screen... -
@mrjj
existing full screen...@RakeshChitte
Hi
Welcome back.
So what happens when you call showNormal(); ?