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
Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine
Can we see the code of your main()?
Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine
Hi,
sure....
here is my main:
Code:
int main(int argc, char **argv)
{
// Prepare log system
CConsoleLog *pConsoleLogger = new CConsoleLog;
std::string Prefix("test");
CFileLog *pFileLogger = new CFileLog(Prefix, false);
CLog::instance()->registerLogDevice(pConsoleLogger);
CLog::instance()->registerLogDevice(pFileLogger);
CLog::instance()->enableDEBUG(true);
CLog::instance()->enableMESSAGE(true);
CLog::instance()->enableWARNING(true);
CLog::instance()->enableERROR(true);
CLog::instance()->enableFATAL(true);
FlightbookManager::instance().setApplicationTitle(Application);
LOG_MESSAGE("Starting " << argv[0] <<
" compiled: " << __DATE__ << ", " << __TIME__);
#ifdef WIN32
// QApplication::setStyle(new QWindowsStyle);
#endif
App.setPalette(Palette);
App.
setWindowIcon(QIcon(":/images/applicationicon.png"));
int ret = 0;
{
MainWindow *pMainWin = new MainWindow;
pMainWin->show();
QPixmap Splash
(":/images/splash.png");
pSplash->showMessage(Application, Qt::AlignLeft|Qt::AlignBottom,
pSplash->show();
if(!pMainWin->initialize()) {
LOG_FATAL("Couldn't initialize, aborting...");
shutdown();
return 1;
}
pSplash->finish(pMainWin);
delete pSplash;
pMainWin->login("");
ret = App.exec();
delete pMainWin;
shutdown();
}
return ret;
}
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?
Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine
the main window:
and in the main.cpp the login method of mainwinow is called which creates the
login dialog (QDialog) :
Code:
bool
MainWindow
::login(const QString &DefaultPilot,
bool bInitialLogin
){
Flightbook::centerInDesktop(*this);
if(m_pLoginDialog)
{
delete m_pLoginDialog;
}
m_pLoginDialog = new LoginDialog(DefaultPilot);
.....
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
Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine
Do you use exec() or show() to show the login dialog?
Re: 4.4.3 Windows - Missing MainWindow when starting Application on other machine
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.