[Development] Can QImage format plugins require QGuiApplication?

Allan Sandfeld Jensen kde at carewolf.com
Mon Apr 13 22:07:59 CEST 2020


On Montag, 13. April 2020 18:50:17 CEST Kevin Kofler wrote:
> Hi,
> 
> I have a question concerning development of plugins for Qt, so hopefully it
> is not entirely off-topic here:
> 
> Today, a user on #fedora-kde ran across a crash which resulted from:
> * a GTK+/GNOME application (Jami) using (for some reason) QImage to load
>   images, without a QGuiApplication or QApplication constructed, vs.
> * a QImage format plugin (QtPBFImagePlugin) using font APIs that require
>   QGuiApplication and abort otherwise.
> 
> Obviously, one or the other must be wrong. So, who is to blame?
> 
> There is also an additional issue, in that the plugin's check for supported
> images is too broad, which leads to it getting (wrongly) automatically
> chosen in the first place and triggering the conflict. We have already
> reported that one as a bug, because in that case, it is clear who is at
> fault:
> https://github.com/tumic0/QtPBFImagePlugin/issues/6
> but I do not know whom to blame for the other issue.
> 
> I have looked at the documentation, but I was not able to find a definite
> answer to my question there either. I see that, e.g.,
> QImageReader::supportedImageFormats() is documented as requiring
> QApplication, but I do not know whether that is relevant here.
> 
I think supporting QImage without QGuiApplication is supported but not recommended. 
We have tests for it in qtbase QTEST_*GUILESS*_MAIN. Not sure it is a documented 
thing though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200413/7c8c8d2f/attachment.html>


More information about the Development mailing list