Review Request 113510: Deprecate methods in kimageio

Alex Merry kde at randomguy3.me.uk
Sun Nov 3 15:48:09 UTC 2013


On 02/11/13 23:09, David Faure wrote:
> On Saturday 02 November 2013 22:36:03 Alex Merry wrote:
>> On 02/11/13 19:36, David Faure wrote:
>>> If we want to get rid of the .desktop files, why don't we just implement
>>> KImageIO on top of QImageReader/Writer, rather than duplicate its code?
>> Only that QImageReader/Writer do not make it easy to correlate mimetypes
>> and image format names.
> 
> Right. But do we still need image format names?
> 
> (I guess the answer lies in http://lxr.kde.org/ident?i=KImageIO but I didn't 
> dig into it yet)
> 
> And if we do need this, how about we add that feature to QImageReader/Writer 
> instead?

All the KImageIO methods have an obvious Qt equivalent except
typeForMime, which takes a mimetype and returns a list of image formats
(which are also filename extensions).

The minority usecase is that actual filename extensions are wanted (for
example, when saving).  This can be replaced by QMimeType::suffixes (or
preferredSuffix).

The majority usecase is to get a string to pass as the format string to
QImage::load, or whatever equivalent method.  This is what
QImageReader/Writer is missing, and I think would be a useful addition.

Specifically, QImageReader/Writer assume the Keys and MimeTypes
properties in the plugin json file are the same length and correlated
(although the documentation does not make that clear).  Implementing
QByteArray QImageReader::imageFormatForMimeType(QByteArray) method, and
the same in QImageWriter, would be pretty easy and make
supportedMimeTypes much more useful.

I'm happy to have a go at submitting this to Qt (along with some
improved documentation), although I've never submitted anything there
before.

Alex


More information about the Kde-frameworks-devel mailing list