Closed fpalazzolo closed 9 months ago
Hi!
thanks for reporting ... I will lokk into this... but give me some time!
Best, JAN
Hi!
I reworked these methods, so the issue should be fixed via https://github.com/jkriege2/JKQtPlotter/commit/995ca920332571d185c2828c0de0756683d82cef ...
Could you please verify?
Thanks, JAN
@fpalazzolo: This should be resolved! Can I close the issue?
This should be fixed. Please reopen if the problem persists, or post a new issue!
THANKS! JAN
The documentation indicates that saveImage() should be able to write to pdf files. But, at least in my case on Windows, if you pass a filename like "test.pdf", the file is not written. The issue is that the variable "selFormat" in JKQTBasePlotter::saveImage() is only set if it is parsed out of the filesave dialog, which is skipped if the filename is already set:
and then later:
After this, filtID is -1, and things are not right from that point on. At this point, an invalid reference gets passed to JKQTBasePlotter::savePixelImage(), which has similar logic, and also finds filtID = -1. Then, the only reason the other formats work at all is that QImage.save() knows how to save all the image formats based on the extension.
I suspect SVG file saving is similarly broken for this use case.
My quick workaround was to use saveAsPDF() directly.
In the end, JKQTBasePlotter::saveImage() (and maybe JKQTBasePlotter::savePixelImage()) should probably be reviewed to insure that they work properly for all file types they support, when the filename is set prior to calling. I don't have time to do this now, but maybe later.