QFrame: Why do i need paint twice to be able to see it?
-
Hello. I've attached a project. It can be useful:
"file:":http://www.olibali.info/pages/starter.tar.gz
It creates a spash screen ( with transparent PNG ) and starts loading things.
( reading settings, allocating memory, setting up dialogs, windows...... these are not included but easily can be done )During loading through a text buffer it tells the user what's going on. When finished opens up the mainwindow.
My problem is that i have to paint twice and only after then emit the showed() function, which will start the initialization. Why is that? If in first paintEvent() i call emit showed() I can't see the painted QFrame. But one paint is done, isn't it?
A few pics:
!http://img46.imageshack.us/img46/8453/screenshotat20111218232.png(first)!
!http://img440.imageshack.us/img440/8453/screenshotat20111218232.png(second)!This is how I solved it, but I don't understand the why... it should work first time...:
in paintEvent() function:
@
itsShowed = 0;
.
.
.
if( itsShowed < 2 ){
itsShowed++;
if( itsShowed == 2 ) emit showed();
}@If i only put
@emit showed();@
in the paintEvent() function, i could only see the window appear after the initialization, but then it's closed right away. So no SplashScreen at all. Why?