Creating a class object "wrapper" inside the mainwindow constructor makes the main window not visible [SOLVED]
Currently trying to create a QWidget inside mainwindows constructor, however once I create the object inside the mainwindow constructor the mainwindow never shows. Any files not listed are identical to the default.
QPalette p(palette()); p.setColor(QPalette::Background, Qt::lightGray); this->setAutoFillBackground(true); this->setPalette(p); this->setWindowTitle(QApplication::translate("toplevel", "CCTV")); mplayer_wrapper *cameras = new mplayer_wrapper("rtsp://169.254.133.191/output","rtsp://169.254.133.193/output"); centralWidget()->layout()->addWidget(cameras);
I have commented out everything inside the constructor of mplayer_wrapper so that it's only creating a black window.
@mplayer_wrapper::mplayer_wrapper(QString cam_1, QString cam_2,QWidget *parent) :
If anyone has an idea why this is failing to launch I would be very grateful. As can't see where I am going wrong at the moment as the only thing I don't have is that I didn't create a ui form during project creation (as I am doing all my layout in code so thought that wasn't necessary). Hopefully someone can point me in the right direct before I pull my hair out.
Don't you by any chance rather have a crash ?
You didn't' set any central widget, at least from the code your posted.
Should do what you want.
Ha epic fail thanks SGaist knew it was something stupid.