Results 1 to 8 of 8

Thread: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

  1. #1
    Join Date
    Jan 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    Hi,

    i have an executable which works fine. When started it shows a MainWindow and a login (q)dialog (which prompts the user to enter username/password).
    Everything works fine.

    When i now copy the complete directory which contains the executable an all Qt DLLs + mingw DLL to another host which has not Qt installed, OR when i create an installer package (with nsis or installJammer)
    and install it on another host the MainWindow does not appear if the executable is started....
    Very strange......

    I start the executable and only the login dialog comes up......After logging in (the dialog exec finishes) the MainWindow pops up....
    How can there a different behaviour between host where it has been compiled and another machine?

    Any ideas?

    Marco

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    Can we see the code of your main()?

  3. #3
    Join Date
    Jan 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    Hi,
    sure....
    here is my main:

    Qt Code:
    1. int main(int argc, char **argv)
    2. {
    3. // Prepare log system
    4. CConsoleLog *pConsoleLogger = new CConsoleLog;
    5.  
    6. std::string Prefix("test");
    7. CFileLog *pFileLogger = new CFileLog(Prefix, false);
    8.  
    9. CLog::instance()->registerLogDevice(pConsoleLogger);
    10. CLog::instance()->registerLogDevice(pFileLogger);
    11.  
    12. CLog::instance()->enableDEBUG(true);
    13. CLog::instance()->enableMESSAGE(true);
    14. CLog::instance()->enableWARNING(true);
    15. CLog::instance()->enableERROR(true);
    16. CLog::instance()->enableFATAL(true);
    17.  
    18. QString Application (QString(Flightbook::APP_STRING) + " ");
    19.  
    20. FlightbookManager::instance().setApplicationTitle(Application);
    21.  
    22.  
    23. LOG_MESSAGE("Starting " << argv[0] <<
    24. " compiled: " << __DATE__ << ", " << __TIME__);
    25.  
    26. QApplication App(argc, argv);
    27.  
    28. #ifdef WIN32
    29. QApplication::setStyle(new QWindowsVistaStyle);
    30. // QApplication::setStyle(new QWindowsStyle);
    31. #endif
    32.  
    33.  
    34. QCoreApplication::setOrganizationName("TEST");
    35. QCoreApplication::setOrganizationDomain("test123.de");
    36. QCoreApplication::setApplicationName("TEST APP");
    37.  
    38. QPalette Palette;
    39. Palette.setColor(QPalette::Highlight, QColor(1,1,255,200));
    40. Palette.setColor(QPalette::HighlightedText, QColor(255,255,255));
    41. App.setPalette(Palette);
    42.  
    43. App.setWindowIcon(QIcon(":/images/applicationicon.png"));
    44. int ret = 0;
    45. {
    46.  
    47. MainWindow *pMainWin = new MainWindow;
    48. pMainWin->show();
    49.  
    50. QPixmap Splash(":/images/splash.png");
    51. QSplashScreen *pSplash = new QSplashScreen(Splash);
    52.  
    53. pSplash->showMessage(Application, Qt::AlignLeft|Qt::AlignBottom,
    54. QColor(255, 255, 255));
    55. pSplash->show();
    56. if(!pMainWin->initialize()) {
    57. LOG_FATAL("Couldn't initialize, aborting...");
    58. shutdown();
    59. return 1;
    60. }
    61.  
    62. pSplash->finish(pMainWin);
    63.  
    64. delete pSplash;
    65.  
    66. pMainWin->login("");
    67.  
    68. ret = App.exec();
    69.  
    70. delete pMainWin;
    71.  
    72. shutdown();
    73. }
    74.  
    75. return ret;
    76. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    In this code I can only see one window that has a chance of being visible - pMainWin. Which is the other one?

  5. #5
    Join Date
    Jan 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Angry Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    the main window:
    Qt Code:
    1. class MainWindow : public QMainWindow
    2. {
    3. Q_OBJECT
    4. ....
    To copy to clipboard, switch view to plain text mode 

    and in the main.cpp the login method of mainwinow is called which creates the
    login dialog (QDialog) :

    Qt Code:
    1. bool
    2. MainWindow::login(const QString &DefaultPilot, bool bInitialLogin)
    3. {
    4. Flightbook::centerInDesktop(*this);
    5.  
    6. if(m_pLoginDialog)
    7. {
    8. delete m_pLoginDialog;
    9. }
    10.  
    11. m_pLoginDialog = new LoginDialog(DefaultPilot);
    12. .....
    To copy to clipboard, switch view to plain text mode 

    So the login dialog always appears. Only the MainWindow isn't shown on virgin machins (with no Qt installed).....
    After login winow finishes first time the MainWindow comes up...

    nando

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    Do you use exec() or show() to show the login dialog?

  7. #7
    Join Date
    Jan 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    Hi,

    i use exec

    nando

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine

    In that case you are probably suffering from QApplicaton::quitOnLastWindowClosed. Set it to false and see if it makes a difference.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.