[Interest] Qt WebEngine: how to handle unsupported content?

Allan Sandfeld Jensen kde at carewolf.com
Thu Oct 15 22:28:28 CEST 2015


On Thursday 15 October 2015, Jason Dolan wrote:
> My company is porting or project from Qt4.8.6 to Qt5.5.1. In doing so, we
> are also porting from QWebkit to QWebEngine since QWebkit is deprecated.
> 
> I'm finding that QWebEngine is very limited in it's ability to deal with
> various files. In Qt4.8.6, I was able to handle most file content with
> QWebPage's unsupportedContent SIGNAL.
> 
> I see that QWebEngine has QWebEngineProfile, which in turn has the
> downloadRequested SIGNAL. This doesn't handle all cases however. In fact,
> it's not extremely clear to me what cases it handles and what it doesn't.
> 
> Using the Browser example in the Qt's exmaple directory I tried out these
> URLS:
> 
> Content-Disposition: inline; filename="foo.pdf"
> http://greenbytes.de/tech/tc2231/inlwithasciifilenamepdf.asis
> <http://greenbytes.de/tech/tc2231/inlwithasciifilenamepdf.asis> -- Does
> nothing
> 
> Content-Disposition: attachment; filename="foo.html"
> http://greenbytes.de/tech/tc2231/attwithasciifilename.asis
> <http://greenbytes.de/tech/tc2231/attwithasciifilename.asis> --Triggers
> downloadRequested(). Yay!
> 
> <object data=“test.pdf" type="application/pdf”></object>
> http://plugindoc.mozdev.org/testpages/pdf.html
> <http://plugindoc.mozdev.org/testpages/pdf.html> --Does nothing
> 
> Direct access to pdf file
> http://plugindoc.mozdev.org/testpages/test.pdf
> <http://plugindoc.mozdev.org/testpages/test.pdf> --Does nothing
> 
> Direct access to a rtf file
> http://thewalter.net/stef/software/rtfx/sample.rtf
> <http://thewalter.net/stef/software/rtfx/sample.rtf> --Triggers
> downloadRequested(). Yay!
> 
> Is there a way I can handle these cases?
> If not in 5.5.1, does anyone know if 5.6 will have support?

Sounds like https://bugreports.qt.io/browse/QTBUG-48764 without having 
investigated I would guess Chromium thinks it is a supported mime-type though 
we don't support the PDFium PDF viewer.

> 
> --
> Jason Dolan
> Software Developer
> PCC
> Control Your Future.
> 
> 800-722-7708
> jason at pcc.com <mailto:jason at pcc.com>
> www.pcc.com <http://www.pcc.com/>
> twitter.com/pccvt




More information about the Interest mailing list