I need help. I'm trying to open 1 of 2 possible windows on start. Program decide which window will open on screen dimensions.
#include <QApplication> #include <QDesktopWidget> #include "mainwindow.h" #include "vincellform.h" #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QDesktopWidget mydesk; if (mydesk.screenGeometry().width() == 800 && mydesk.screenGeometry().height() == 480) { VincellForm vf; vf.show(); } else { MainWindow w; w.show(); } return a.exec(); } I think that this code is correct, but it isn't. If I'm on different screen (1280*1024 I think) program goes to else part (MainWindow w; w.show();) and then goes to return, but no window is opened. But if I changed a code to:
#include <QApplication> #include <QDesktopWidget> #include "mainwindow.h" #include "vincellform.h" #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QDesktopWidget mydesk; if (mydesk.screenGeometry().width() == 800 && mydesk.screenGeometry().height() == 480) { VincellForm vf; vf.show(); } MainWindow w; w.show(); return a.exec(); } it runs perfectly (MainWindow will open after return). I can't even imagine where the problem can be... Thank you very much