You are not logged in.

1

Monday, May 25th 2009, 2:18pm

QPixmap::save help

I can't get QPixmap::save to work outside of my development environment. I build it in release with qtcreator run it with the dll's it needs (qtcore and qtgui). I will get "save successful" in my environment and then the screenshot saved in filepath. The application runs in others but I get "save failed". It writes a 0kb jpeg, but no data. I've tried it on multiple computers and the directory is writable. Any ideas?

Source code

1
2
3
4
5
6
7
8
QPixmap image = QPixmap::grabWindow(QApplication::desktop()->winId());
if ( image.isNull() )
w.SetLabel("image returned null");
else if ( image.save(filepath,format.toAscii()) )
w.SetLabel("save successful");
else {
w.SetLabel("save failed");
}

2

Monday, May 25th 2009, 2:36pm

Distribute plugins too. For example
[application directory]/imageformats/qjpeg4.dll
Read about qt plugin system
Fighting fire with fire.
Three can keep a secret if two of them are dead.

3

Monday, May 25th 2009, 5:15pm

Thank you! Its the fact that its looking for it in the /imageformats that threw me off. :pinch: