[Interest] QImage::save forces client to open file before call

alexander golks alex at golks.de
Thu Nov 21 15:09:33 CET 2013


hi,

after switching from 4.3.0 to current 4.8.5 i have seen that doing this:

  QImage image;
  image.save("goodfilename.tif"); // or whatever supported format

is not working anymore. a bit digging done, i see the relevant code change was
made in 4.5.0:

bool QImageWriter::canWrite() const
{
    if (d->device && !d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0)

this first "if" was made last in here in qt versions < 4.5.0, where the device
was opened when not already done BEFORE this if.

now, createWriteHandlerHelper(...) calls QImageIOPlugin::capabilities(...)
after all, which is implemented in every (?) qt image plugin this way or alike:

  if (!device->isOpen())
    return 0;

so the createWriteHandlerHelper() will return false, because the device is not
open, resulting in a failing call to my image.save("goodfilename.tif").

the question now is, why was this change made?
this change is very strange to me, since it renders this convenience function
useless.

does anyone have any hints on this?
should i file a bugreport for this, or was this change intended and why?

thx, 
alex

-- 
/*
 *  printk("Churning and Burning -");
 *          linux-2.6.6/drivers/char/lcd.c
 */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131121/6de35b5e/attachment.sig>


More information about the Interest mailing list