Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stop download with QNetworkReply
QtWS25 Last Chance

Stop download with QNetworkReply

Scheduled Pinned Locked Moved Solved General and Desktop
qnetworkreply
20 Posts 4 Posters 5.1k 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.
  • A Offline
    A Offline
    ARASHz4
    wrote on last edited by
    #1

    i can't stop download with this code

    reply->abort();
    

    Download is stopped but still using network for download file!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      What you mean " still using network for download file"
      What if u completely close program. Is this usage then stopped?

      A 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        What you mean " still using network for download file"
        What if u completely close program. Is this usage then stopped?

        A Offline
        A Offline
        ARASHz4
        wrote on last edited by
        #3

        @mrjj yes when completely close program usage stop

        mrjjM 1 Reply Last reply
        0
        • A ARASHz4

          @mrjj yes when completely close program usage stop

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ARASHz4 said:
          ok. maybe silly questions but the QNetworkReply you abort() is
          the only active one?

          A 1 Reply Last reply
          0
          • mrjjM mrjj

            @ARASHz4 said:
            ok. maybe silly questions but the QNetworkReply you abort() is
            the only active one?

            A Offline
            A Offline
            ARASHz4
            wrote on last edited by ARASHz4
            #5

            @mrjj Sorry what you mean 'only active one' ?

            mrjjM 1 Reply Last reply
            0
            • A ARASHz4

              @mrjj Sorry what you mean 'only active one' ?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @ARASHz4
              Im just fishing.
              Is there any chance u abort other one
              than the actual download one?

              A 1 Reply Last reply
              1
              • mrjjM mrjj

                @ARASHz4
                Im just fishing.
                Is there any chance u abort other one
                than the actual download one?

                A Offline
                A Offline
                ARASHz4
                wrote on last edited by ARASHz4
                #7

                @mrjj no i just have one download

                mrjjM 1 Reply Last reply
                0
                • A ARASHz4

                  @mrjj no i just have one download

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @ARASHz4
                  Ok. abort should do it as far as I know.
                  Sorry. lets wait and see if someone has better ideas.

                  A 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @ARASHz4
                    Ok. abort should do it as far as I know.
                    Sorry. lets wait and see if someone has better ideas.

                    A Offline
                    A Offline
                    ARASHz4
                    wrote on last edited by ARASHz4
                    #9

                    @mrjj OK this is my Project if you can take look

                    mrjjM 1 Reply Last reply
                    1
                    • A ARASHz4

                      @mrjj OK this is my Project if you can take look

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @ARASHz4
                      Thx. its cute :)
                      I can use any file for test?

                      A 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @ARASHz4
                        Thx. its cute :)
                        I can use any file for test?

                        A Offline
                        A Offline
                        ARASHz4
                        wrote on last edited by
                        #11

                        @mrjj yes I think

                        ? mrjjM 2 Replies Last reply
                        0
                        • A ARASHz4

                          @mrjj yes I think

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #12

                          Hi! Does this also happen when you replace abort() with close()? Another thing: After calling abort(), is the finished() signal emitted?

                          ? 1 Reply Last reply
                          0
                          • ? A Former User

                            Hi! Does this also happen when you replace abort() with close()? Another thing: After calling abort(), is the finished() signal emitted?

                            ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #13

                            And: On what platform do you observe this behaviour? Windows? Linux?

                            A 1 Reply Last reply
                            0
                            • ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #14

                              BTW: In your cancelDownload() function, it says:

                              reply->abort();
                              reply = 0;
                              

                              Looks like a memory leak to me.

                              1 Reply Last reply
                              0
                              • ? A Former User

                                And: On what platform do you observe this behaviour? Windows? Linux?

                                A Offline
                                A Offline
                                ARASHz4
                                wrote on last edited by
                                #15

                                @Wieland
                                i test before close()
                                i use Windows now

                                1 Reply Last reply
                                0
                                • A ARASHz4

                                  @mrjj yes I think

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @ARASHz4

                                  hi
                                  in

                                  Downloader::Downloader(QUrl Url, QObject *parent) :
                                      QObject(parent)
                                  {
                                      QNetworkRequest request(Url);
                                      DownloadManager.get(request);<<<<< THIS ?
                                  
                                      reply =  DownloadManager.get(request);
                                  

                                  you have extra DownloadManager.get(request);
                                  if I // it, it now drops to 0 when I abort.
                                  Before it did not.

                                  ? A 3 Replies Last reply
                                  1
                                  • mrjjM mrjj

                                    @ARASHz4

                                    hi
                                    in

                                    Downloader::Downloader(QUrl Url, QObject *parent) :
                                        QObject(parent)
                                    {
                                        QNetworkRequest request(Url);
                                        DownloadManager.get(request);<<<<< THIS ?
                                    
                                        reply =  DownloadManager.get(request);
                                    

                                    you have extra DownloadManager.get(request);
                                    if I // it, it now drops to 0 when I abort.
                                    Before it did not.

                                    ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #17

                                    @mrjj Guter Mann. ;-)

                                    1 Reply Last reply
                                    1
                                    • mrjjM mrjj

                                      @ARASHz4

                                      hi
                                      in

                                      Downloader::Downloader(QUrl Url, QObject *parent) :
                                          QObject(parent)
                                      {
                                          QNetworkRequest request(Url);
                                          DownloadManager.get(request);<<<<< THIS ?
                                      
                                          reply =  DownloadManager.get(request);
                                      

                                      you have extra DownloadManager.get(request);
                                      if I // it, it now drops to 0 when I abort.
                                      Before it did not.

                                      A Offline
                                      A Offline
                                      ARASHz4
                                      wrote on last edited by ARASHz4
                                      #18

                                      @mrjj DownloadManager is a private member in downloader.h

                                      1 Reply Last reply
                                      0
                                      • mrjjM mrjj

                                        @ARASHz4

                                        hi
                                        in

                                        Downloader::Downloader(QUrl Url, QObject *parent) :
                                            QObject(parent)
                                        {
                                            QNetworkRequest request(Url);
                                            DownloadManager.get(request);<<<<< THIS ?
                                        
                                            reply =  DownloadManager.get(request);
                                        

                                        you have extra DownloadManager.get(request);
                                        if I // it, it now drops to 0 when I abort.
                                        Before it did not.

                                        A Offline
                                        A Offline
                                        ARASHz4
                                        wrote on last edited by
                                        #19

                                        @mrjj Yes thank you now I understand
                                        i Fix it

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          seyed
                                          wrote on last edited by
                                          #20

                                          In my case, disconnecting all signals relating to QNetworkReply from all slots causes to abort() not works.

                                          disconnect(m_reply, nullptr, nullptr, nullptr);
                                          

                                          abort function works normal after commenting this line.

                                          1 Reply Last reply
                                          2

                                          • Login

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