Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. WebEngineView html have <a>
Qt 6.11 is out! See what's new in the release blog

WebEngineView html have <a>

Scheduled Pinned Locked Moved QtWebEngine
15 Posts 3 Posters 6.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by p3c0
    #2

    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 create WebEngineProfile you need to set it to WebEngineView's profile property. Thus when download is requested the signal is triggered in WebEngineProfile 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 named download. Note that actual downloading only starts when user accept's it. Before accepting download we can set the download path. The default path before setting contains download folder + file name.

    157

    T 1 Reply Last reply
    1
    • p3c0P 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 create WebEngineProfile you need to set it to WebEngineView's profile property. Thus when download is requested the signal is triggered in WebEngineProfile 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 named download. Note that actual downloading only starts when user accept's it. Before accepting download we can set the download path. The default path before setting contains download folder + file name.

      T Offline
      T Offline
      THEFree
      wrote on last edited by
      #3

      @p3c0 i love you

      p3c0P 1 Reply Last reply
      1
      • T THEFree

        @p3c0 i love you

        p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #4

        @THEFree :)

        157

        T 1 Reply Last reply
        0
        • p3c0P p3c0

          @THEFree :)

          T Offline
          T Offline
          THEFree
          wrote on last edited by
          #5

          @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

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #6

            @THEFree set storageName and also httpCacheType to WebEngineProfile.DiskHttpCache

            157

            T 1 Reply Last reply
            0
            • p3c0P p3c0

              @THEFree set storageName and also httpCacheType to WebEngineProfile.DiskHttpCache

              T Offline
              T Offline
              THEFree
              wrote on last edited by
              #7

              @p3c0 Can you write it please??

              (●'◡'●)

              1 Reply Last reply
              0
              • p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #8

                @THEFree Here you go:

                WebEngineProfile {
                    id: eprofile
                    storageName: "MyDefaultProfile"
                    httpCacheType: WebEngineProfile.DiskHttpCache
                }
                

                157

                T 1 Reply Last reply
                0
                • p3c0P p3c0

                  @THEFree Here you go:

                  WebEngineProfile {
                      id: eprofile
                      storageName: "MyDefaultProfile"
                      httpCacheType: WebEngineProfile.DiskHttpCache
                  }
                  
                  T Offline
                  T Offline
                  THEFree
                  wrote on last edited by THEFree
                  #9

                  @p3c0 Maybe you don't know I mean.,i give you image

                  1:not use WebEngineProfile,i open the software

                  0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0

                  login
                  0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd

                  close,-----open again
                  0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd

                  -----------------------------------------------------------------------------------

                  2:but now

                  0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0
                  login
                  0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd
                  close,-----open again
                  0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0

                  why is not log on automatically

                  T 1 Reply Last reply
                  0
                  • T THEFree

                    @p3c0 Maybe you don't know I mean.,i give you image

                    1:not use WebEngineProfile,i open the software

                    0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0

                    login
                    0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd

                    close,-----open again
                    0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd

                    -----------------------------------------------------------------------------------

                    2:but now

                    0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0
                    login
                    0_1476257775771_upload-c9a3a843-9b27-4f2c-81ec-a34d24dbc3cd
                    close,-----open again
                    0_1476257847315_upload-6d06eba1-07e4-4c89-8368-52365f40c0a0

                    why is not log on automatically

                    T Offline
                    T Offline
                    THEFree
                    wrote on last edited by
                    #10
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #11

                      @THEFree Does your application store cookies ? Or else it wont be able to auto login.

                      157

                      T 1 Reply Last reply
                      0
                      • p3c0P p3c0

                        @THEFree Does your application store cookies ? Or else it wont be able to auto login.

                        T Offline
                        T Offline
                        THEFree
                        wrote on last edited by p3c0
                        #12

                        @p3c0 is OK,Thanks very much
                        0_1476261689978_upload-fd0a8c74-d2a8-408b-b8cd-045e08d81135

                        1 Reply Last reply
                        0
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by p3c0
                          #13

                          @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.

                          157

                          T 1 Reply Last reply
                          0
                          • p3c0P p3c0

                            @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.

                            T Offline
                            T Offline
                            THEFree
                            wrote on last edited by
                            #14

                            @p3c0 image's mean is "thank you"

                            1 Reply Last reply
                            0
                            • p3c0P Offline
                              p3c0P Offline
                              p3c0
                              Moderators
                              wrote on last edited by
                              #15

                              @THEFree Oh! You're Welcome :)

                              157

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved