QT and Video Interfaces
-
Hi
Seems to be a dangling pointer maybe ?
You have
QWidget* videoframe;which you never set to anything in the code shown.
You show an ui file so i wonder if you mean
ui->videoframe
instead ?To use the one you have placed on the UI and not the one you have manually added.
-
This post is deleted!
-
@mranger90 said in QT and Video Interfaces:
Does it crash when executing inside of QtCreator or outside ?
If it crashes inside of QtCreator than check the stack trace.
If it crashes outside of QtCreator than you need to do a deploy.Hi @mranger90 it crashed inside the QT Creator when I try to press the run button
-
@mrjj said in QT and Video Interfaces:
Hi
Seems to be a dangling pointer maybe ?
You have
QWidget* videoframe;which you never set to anything in the code shown.
You show an ui file so i wonder if you mean
ui->videoframe
instead ?To use the one you have placed on the UI and not the one you have manually added.
@mrjj yea I want to use the QVideoWidget inside the "videoframe" Qwidget that is created in the Ui shown in dotted rectangle in the UI screen shot. However I don't know how to use link it all together, is it ui->videoframe like you mentioned?
-
@Stevendragoes
Hi
Yes as the UI hold the widgets you put in visually and
the other one seems like a dangling pointer which will crash. -
Hello @mrjj
I have done the necessary changes. However, the video is not showing in the rectangle frame that I have drawn.
-
I have typed in according to what you have mentioned
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); player = new QMediaPlayer(ui->videowidget); vw = new QVideoWidget(ui->videowidget); player->setVideoOutput(vw); }
However, the video does not load when I loaded the video. I have the text box to check the file path. the file path is fine. However, the video could not be displayed in the custom rectangle box that I drew.
-
After trying out and researching, I found a lazy man's way of showing in the UI, could be called my first draft.
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); player = new QMediaPlayer(this); vw = new QVideoWidget(this); player->setVideoOutput(vw); vw->setGeometry(30,140,800,600); vw->show(); }
However, I want to cast into the grid layout as the result wasn't up to my expectations.. I want the videoframe to resize when the window resizes.. Any Idea how? I didn't use the QWidget to load the video. If i were to use the QWidget to load the video, it will be good.
-
-
Alright @jsulm I will go and learn about the layout and do some trial and errors. Any questions I will ask again. Thanks for assisting me