Qt Project freezes at start and does not show window
-
I created a Qt project for a university class 3 years ago and recently wanted to check it out again. Trying this I noticed, that the project does not work anymore. When trying to build and run the project in Qt Creator, the application freezes and needs to be force quitted. The debug mode tells me, that the program freezes in the main.ccp file at "return a.exec();". The "StartMenue" is a class inheriting from QMessageBox and should be displayed (which it is not).
I have not touched the project in the past 3 years and am also still using the same Qt version: Qt Creator 4.12.0
Based on Qt 5.14.2 (Clang 10.0 (Apple), 64 bit)
Built on Apr 22 2020 01:15:50
I also have not worked with Qt in that time either and am really rusty about pretty much everything.
I also do not get any error messages.
I would really love to get this working again, so any ideas and help would be greatly appreciated. If any additional information is necessary, I am also happy to show the actual code, I just did not want this post to get too long.I tried rebuilding the project multiple times.
But as I said, I am really lost here, as it worked 3 years ago and I did not change anything.
Shown here is a more minimal implementation where I get the same problem.
#include <QApplication> #include <QtWidgets> class StartMenue: public QMessageBox { public: QGraphicsView * view; QGraphicsScene * scene; StartMenue() { scene = new QGraphicsScene(); scene->setBackgroundBrush(Qt::lightGray); scene->setSceneRect(1200, 1200, 0, 0); QGraphicsProxyWidget *proxy = scene->addWidget(this); view = new QGraphicsView(scene); view->show(); } }; int main(int argc, char* argv[]) { QApplication a(argc, argv); StartMenue * sm = new StartMenue(); return a.exec(); }
I also tried using newer OpenSource Versions of Qt like 7.0.2 and 5.0.3 but there it says that I do not have any suitable Kits, and I also have no clue how to solve that. I think that was provided back then by the University or something. I want to create a .app file that I can run on both Intel and Silicon Macs. I also do not necessarily need the project to work and build in Qt, if there is any other way to create the .app file. If anybody has any idea on how to solve that, that would be amazing, as I would really love to be able to open my project again. Thanks in advance!
-
Hi and welcome to devnet,
I don't want to sound blunt but that code has so many issues that it screams for a proper refactoring.
That said, I can start it on macOS with Qt 6.5 but it will crash at the end.
-
@SGaist I wrote that code during my first college year and learned qt on the go, so I can understand if it's not up to your standards. You do not want to see the rest of it...
However, do you know a possible cause of the issue? I tried downloading the mentioned Qt versions, but the problem persists. Still no errors, it just does not work. Any help would be welcome.