PDA

View Full Version : QPixmap::convertFromImage error (qt 4.1.1, g++ 3.3.2, Solaris SPARC 10)



freak
27th October 2006, 23:32
I'm having the following problem. I build an application on solaris 10 machine add a few images to the GUI and it works fine on the machine I build it on.

When I move my application to a different solaris 10 machine it runs but no images are displayed and I get the following error:


QPixmap::convertFromImage: Cannot convert a null image

The sample code of one of the images is the following :



QImage logo(":/images/logo.jpg");

QLabel *imageLabel = new QLabel;

imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(false);
imageLabel->setPixmap(QPixmap::fromImage(logo));
imageLabel->resize(190,78);


Any help is appreciated. Thanks in advanced.

jacek
28th October 2006, 01:06
Did you copy JPEG plugin to that other machine?

freak
30th October 2006, 16:30
Greetings,

I'm actually trying to deploy the built application to another Solaris machine rather than try to build it there since I do not have a development environment on that one. Do I still have to add a plugin? if so, how is this done?

I guess my question is, how do you deploy an app that has images (jpg format) embedded in it using the resources method?

Thanks in advanced.

Freak

jacek
30th October 2006, 22:30
Do I still have to add a plugin? if so, how is this done?
The code that handles JPEG format is in the plugin, if it won't be available, you won't have JPEG support.

You can create "imageformats" subdirectory in the directory where your executable is and place the plugin there, but there are other possibilities (described here (http://doc.trolltech.com/4.1/deployment-x11.html)). Also you might try to compile the plugin into your application as a static plugin (http://doc.trolltech.com/4.1/plugins-howto.html#static-plugins), but I'm not sure if it will work with non-static Qt.