PDA

View Full Version : image not showing in splash screen



dave2k
21st February 2012, 20:36
Hi

I am developing on a Mac. I added a QSplashScreen to my app and it worked nicely, displaying a transparent png. Since i added the following call (before i create my QApplication object as per the docs), all i get is a grey window, the same dimensions as my png:

QApplication::setGraphicsSystem("raster");

If i uncommented then the image comes back. It's vital to my app that it draws in raster mode.

Any help would be great,

thanks

David

ChrisW67
22nd February 2012, 00:35
Is the entire area grey, or just the transparent area?
I have seen other mention of translucency on Mac under the raster renderer: here

You might like to share a bit more code.

dave2k
22nd February 2012, 00:46
Hi

Its nothing to do with the image being transparent, since I tried with non-transparent image
And the effect is the same,

What other code do you need?

The entire area is grey. It seems to be an issue with rendering images before the main application loop,
When working in raster mode on a mac.

ChrisW67
22nd February 2012, 00:56
The code that shows how you are creating the splash screen, showing it, and calling processEvents() etc...

dave2k
22nd February 2012, 10:35
Hi

I created a simple window application to reproduce the problem, which i believe must be a Qt bug. Here is the code for main.cpp:



#ifdef Q_OS_WIN
#include <windows.h> // for Sleep
#else
#include <time.h>
#endif

static void Sleep(int ms)
{
//QTEST_ASSERT(ms > 0);

#ifdef Q_OS_WIN
Sleep(uint(ms));
#else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
#endif
}

int main(int argc, char *argv[])
{
// need this on mac to render web contents nice and smooth
QApplication::setGraphicsSystem("raster");

QApplication a(argc, argv);

QSplashScreen splash(QPixmap(":/showme.jpg"));
splash.show();

Sleep(2000);

splash.hide();

MainWindow w;
w.show();

return a.exec();
}