Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
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");
}
|
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.
Thank you! Its the fact that its looking for it in the /imageformats that threw me off.