Using QGraphicsView as a Splash Screen (repaint issues)
I've been using QGraphicsView as a splash screen since 4.3. Unfortunately I had to put in some hacks to get it to repaint correctly while the rest of the application was loading. The following code was called any time the status message or progress changed
The weird thing is that this no longer works with Qt 4.4. So I was hoping that someone could help me figure out a sensible way to get my custom splash screen to work. Its just a QDialog with
Code:
Qt::FramelessWindowHint | Qt::Window
that has a QGraphicsView as a child widget. My current work around does the trick but I would prefer not to call QApplication::processEvents() even though I'm using
I tried creating some paint events and sending them over QApplication::postEvent() and QApplication::sendPostedEvents() but I couldnt get that to work either.
My original plan was to make the Splash Screen a separate process that talked over TCP (in order to get around the repaint issues) but I think engineering an entire system for a splash screen is a bit overkill. Is there anyway to force a graphics view to repaint immediately? Any suggestions?
Re: Using QGraphicsView as a Splash Screen (repaint issues)
Why didn't you use QSplashScreen? A repaint needs a spinning event loop, regardless of what classes you use. TCP also needs a spinning event loop, so unless you start processing events, nothing will get repainted.
Re: Using QGraphicsView as a Splash Screen (repaint issues)
QGraphicsView as a Splash Screen :confused:,
Why you not open Gimp/or other Editor draw 4 or 5 PNG image to compose a Animated Portable Network Graphics compress this to one APNG ( save it as resource file like normal image) multiple frame and load it on a QSplashScreen + timer event widged ad show it like a movie...
To compose APNG image you can use:
https://addons.mozilla.org/en-US/firefox/addon/5519
http://www.qt-apps.org/content/show....?content=82221
http://www.qt-apps.org/content/show....?content=81573
or commercial
http://www.gamani.com/apng.htm 30 $
IMO:
I forget to propose APNG format on QSplashScreen
http://trolltech.com/developer/task-...5&method=entry
i say only QMovie & QWebView ...
but is simple to read qt code from http://fop-miniscribus.googlecode.co...tiondevice.cpp and run APNG file on QSplashScreen
Re: Using QGraphicsView as a Splash Screen (repaint issues)
A QGraphicsView should be just as good as a QSplashScreen. Using a QGraphicsView allows you to do much more interesting splash screens plus you have control of the layout. For example I've implemented a "progress bar" but it's circular instead of linear. And the status text is comp'd over the bg image instead of below it.
I suppose it would be possible to use a QSplashScreen along with a QPainter. Essentially all a QSplashScreen is, is a widget with a canned layout, some window flags and a couple of convenience functions. Either way according to the documentation I'll still have the same repaint issues:
Code:
splash->show();
... // Loading some items
splash->showMessage("Loaded modules");
qApp->processEvents();
... // Establishing connections
splash->showMessage("Established connections");
qApp->processEvents();
In Qt3 calling repaint caused the widget to repaint immediately. It doesn't seem like the same thing is happening here. It would be better if you could do the following:
Code:
splash->show();
... // Loading some items
splash->showMessage("Loaded modules");
splash->repaint();
... // Establishing connections
splash->showMessage("Established connections");
splash->repaint();