Downloading from qrc:// using the QtWebKit - QWebView
I'm coding a basic browser using QWebView.
I need all sources to be compiled into the application; for that I used
functionality to 'download' a file that is inside it.
Somewhere inside the HTML code there is a link pointing to a file inside the qrc origin like this:
@<a href="files/1_3_activity_sheet_1a(ii)_my_skills_profile.docx">Download this file</a>@
Copying the link this is what is put into the clipboard: qrc:/website/files/1_3_activity_sheet_1a(ii)_my_skills_profile.docx
Using the 'inspect' option in the WebKit I found out that the browser was giving out these warnings/errors:
@Resource interpreted as Document but transferred with MIME type application/zip: "qrc:/website/files/1_3_activity_sheet_1a(ii)_my_skills_profile.docx".@
@GET qrc:/website/files/1_3_activity_sheet_1a(ii)_my_skills_profile.docx Frame load interrupted by policy change qrc:/website/files/1_3_activity_sheet_1a(ii)_my_skills_profile.docx:1@
This is the way I set up my QWebSettings:
Is this something that definitely can't be done?, or Is there any workaround for this?
since webkit is just a web viewer and it doesn't provide the downloader, you must handle MIME types yourself and process any files which is NOT known as a web page or web element with your own handler.
webkit can only give you the most important part of a complete web browser in addition brings you the ability of using your c++ code on any web element to have full control on elements and passing calls to each other using "Signals and Slots Mechanism":http://qt-project.org/doc/qt-4.8/signalsandslots.html
Hi, thanks for answering.
I was kind of hoping I didn't need to handle particular downloads.
The error message I was getting, hinted me that maybe the
browser did try to download the file. Maybe I was interpreting it wrong.