Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to get signal and download link from WebView

How to get signal and download link from WebView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
14 Posts 4 Posters 1.8k Views
  • 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.
  • M Mikeeeeee

    I made a file Downloader, I need to get the download signal and download link.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #5

    @mikeeeeee said in How to get signal and download link from WebView:

    download signal

    What signal is that? Do you mean if the user clicks on a link, or what?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    1
    • M Mikeeeeee

      I made a file Downloader, I need to get the download signal and download link.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #6

      @mikeeeeee said in How to get signal and download link from WebView:

      I need to get the download signal and download link.

      im not sure what that means

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #7

        The user clicks the download button. I need him to press a button, get a download link.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mikeeeeee
          wrote on last edited by
          #8

          WebView in C++ gave signals when you need to download a file. How to do this in QML?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #9

            In c++ this work, how I can get signal for download in QML?

            MainWindow::MainWindow(QWidget parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
            {
            ui->setupUi(this);
            ui->webView->page()->setForwardUnsupportedContent(true);
            connect(ui->webView->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(download(QNetworkRequest)));
            connect(ui->webView->page(),SIGNAL(unsupportedContent(QNetworkReply
            )),this,SLOT(unsupportedContent(QNetworkReply*)));
            }

            MainWindow::~MainWindow()
            {
            delete ui;
            }

            void MainWindow::download(const QNetworkRequest &request){
            // request.url() - это то, откуда вам нужно скачать файл или изображение
            qDebug()<<"Download Requested: "<<request.url();
            }

            void MainWindow::unsupportedContent(QNetworkReply * reply){

            qDebug()<<"Unsupported Content: "<<reply->url();
            

            }

            1 Reply Last reply
            0
            • IntruderExcluderI Offline
              IntruderExcluderI Offline
              IntruderExcluder
              wrote on last edited by
              #10

              Set a proper WebEngineProfile to your WebEngineView, then use downloadRequested signal.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by Mikeeeeee
                #11

                But WebEngine does not compile for Android.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #12

                  I need a WebView solution.

                  1 Reply Last reply
                  0
                  • IntruderExcluderI Offline
                    IntruderExcluderI Offline
                    IntruderExcluder
                    wrote on last edited by
                    #13

                    Looks like there is no easy solution for Android. If you are good enough in Java and JNI you can probably change QtAndroidWebViewController and set download listener. Not sure if it possible, just quick look into it leads me there.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Mikeeeeee
                      wrote on last edited by
                      #14

                      I don't know how to do that. Help please with this.

                      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