WebEngineView html have <a>
-
my html have
<a href="/andy_file/static/src/img/del.png" download="w3logo" class="andy_file_Dow">now
my webengineview how to download this file??
how to do
im sorry my English is so bad!!!Moved from Testing - p3c0
-
Hi,
my webengineview how to download this file??
Using WebEngineProfile. It provides these signals which sends a WebEngineDownloadItem. This object provides all information of the item to be downloaded.
So once you createWebEngineProfile
you need to set it to WebEngineView's profile property. Thus when download is requested the signal is triggered inWebEngineProfile
and can be handled in its corresponding handler.Here's a minimal example of how it works:
import QtQuick 2.6 import QtQuick.Window 2.2 import QtWebEngine 1.2 Window { visible: true width: 800 height: 500 WebEngineProfile { id: eprofile onDownloadRequested: { var item = download item.path = "/home/userfolder/pic.jpg" item.accept() } } WebEngineView { id: webview url: "http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_download" anchors.fill: parent profile: eprofile } }
In above example
onDownloadRequested
is the signal handler where we get access to the download item's object nameddownload
. Note that actual downloading only starts when user accept's it. Before accepting download we can set the download path. The defaultpath
before setting contains download folder + file name. -
@p3c0 i love you
-
@THEFree :)
-
@p3c0 but got a whole new set of problems now
1:I open the software, login html
2:close the software
3:Open software again (I have to login in again)
After use WebEngineProfile
-
@THEFree set storageName and also httpCacheType to
WebEngineProfile.DiskHttpCache
-
@p3c0 Can you write it please??
(●'◡'●)
-
@THEFree Here you go:
WebEngineProfile { id: eprofile storageName: "MyDefaultProfile" httpCacheType: WebEngineProfile.DiskHttpCache }
-
@p3c0 Maybe you don't know I mean.,i give you image
1:not use WebEngineProfile,i open the software
login
close,-----open again
-----------------------------------------------------------------------------------
2:but now
login
close,-----open again
why is not log on automatically
-
This post is deleted! -
@THEFree Does your application store cookies ? Or else it wont be able to auto login.
-
@p3c0 is OK,Thanks very much
-
@THEFree Have you posted any image ? Image upload in the forum is currently not working. Please upload it to some image hosting site and post the link here.
-
@p3c0 image's mean is "thank you"
-
@THEFree Oh! You're Welcome :)