I have a little question about Qt custom Widgets.
Both in http://doc.qt.digia.com/4.3/tutorial-t4.html and http://doc.qt.digia.com/4.3/tutorial-t8.html, the custom window declaration is made in the main.cpp file, where the qApp pointer is accesible(in the second link, more widgets are declared in their own files).
Couldn't the window be done in another different file and have the qApp pointer passed to it?.
Yes, the main windows can be created in another file. All you need in the main is to create the QApplication and show something that you include. And then start the event loop.
You don't have to pass qApp pointer anywhere. It is a global reference to the only single application that can be running. Just access it in any other file by including QApplication.
Also be advised, those tutorials are for Qt 4.3 which is old (unless you are bound to use that version right now). You can find tutorials for Qt 4.8 here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With