PDA

View Full Version : QCoreApplication::postEvent();



chrisdsimpson
31st March 2008, 22:24
Hi

I am trying to do a postEvent to the QSplash screen that i created in the main statup.

I am not sure how to build the event can someone help



QCoreApplication::postEvent(splash, QHideEvent::QHideEvent());

I not quite sure what I am doing wrong but I get a build error undder Windows VS 2005


1>.\ine-de.cpp(108) : error C2665: 'QCoreApplication::postEvent' : none of the 2 overloads could convert all the argument types
1> c:\qt\4.3.3\include\qtcore\../../src/corelib/kernel/qcoreapplication.h(83): could be 'void QCoreApplication::postEvent(QObject *,QEvent *)'
1> while trying to match the argument list '(QSplashScreen *, QHideEvent)'

Thanks
Chris

wysota
31st March 2008, 22:25
How about simply calling splash->hide()? :)

chrisdsimpson
31st March 2008, 22:32
The app throws an exception. There is lots of dialog calls in the constructor of the main class. Thats why I need it go away sooner than in the example. I am not sure why but any direct refference to the splashsreen kills the app.

wysota
31st March 2008, 22:36
An uninitialized pointer maybe?

chrisdsimpson
1st April 2008, 20:39
I got the post event syntax right I just can't get it right to inlialize the global pointer to splash screen. I have "Qsplashscreen *splash;" in the application header what would the syntax be in main using this global pointer reference.

wysota
1st April 2008, 21:12
So far you have a pointer. Did you assign an actual object to it?

chrisdsimpson
1st April 2008, 21:23
OK I fixed the hole problem

From
QSplashScreen *splash = new QSplashScreen(pixmap, Qt::WindowStaysOnTopHint);
to
QSplashScreen *splash = new QSplashScreen(pixmap);


I just need to remove the QT flag and now the dialogs just show up on top of the splash screen and then when the app es exited the splash goes away coreclty. I think by using the Qt::WindowStaysOnTopHint flag I was forcing the dialogs to remiane behind the splash screen. All is good now

Thanks,
Chris