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
Forum Updated to NodeBB v4.3 + New Features

Stop download with QNetworkReply

Scheduled Pinned Locked Moved Solved General and Desktop
qnetworkreply
20 Posts 4 Posters 5.4k Views 2 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.
  • A Offline
    A Offline
    ARASHz4
    wrote on 9 May 2016, 16:07 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 9 May 2016, 16:48 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 9 May 2016, 17:20
      0
      • M mrjj
        9 May 2016, 16:48

        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 9 May 2016, 17:20 last edited by
        #3

        @mrjj yes when completely close program usage stop

        M 1 Reply Last reply 9 May 2016, 17:22
        0
        • A ARASHz4
          9 May 2016, 17:20

          @mrjj yes when completely close program usage stop

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 9 May 2016, 17:22 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 9 May 2016, 17:31
          0
          • M mrjj
            9 May 2016, 17:22

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

            A Offline
            A Offline
            ARASHz4
            wrote on 9 May 2016, 17:31 last edited by ARASHz4 5 Sept 2016, 17:33
            #5

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

            M 1 Reply Last reply 9 May 2016, 17:35
            0
            • A ARASHz4
              9 May 2016, 17:31

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

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 9 May 2016, 17:35 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 9 May 2016, 17:37
              1
              • M mrjj
                9 May 2016, 17:35

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

                A Offline
                A Offline
                ARASHz4
                wrote on 9 May 2016, 17:37 last edited by ARASHz4 5 Sept 2016, 17:38
                #7

                @mrjj no i just have one download

                M 1 Reply Last reply 9 May 2016, 17:42
                0
                • A ARASHz4
                  9 May 2016, 17:37

                  @mrjj no i just have one download

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 9 May 2016, 17:42 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 9 May 2016, 17:48
                  0
                  • M mrjj
                    9 May 2016, 17:42

                    @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 9 May 2016, 17:48 last edited by ARASHz4 5 Sept 2016, 17:48
                    #9

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

                    M 1 Reply Last reply 9 May 2016, 17:52
                    1
                    • A ARASHz4
                      9 May 2016, 17:48

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

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 9 May 2016, 17:52 last edited by
                      #10

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

                      A 1 Reply Last reply 9 May 2016, 17:53
                      0
                      • M mrjj
                        9 May 2016, 17:52

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

                        A Offline
                        A Offline
                        ARASHz4
                        wrote on 9 May 2016, 17:53 last edited by
                        #11

                        @mrjj yes I think

                        ? M 2 Replies Last reply 9 May 2016, 18:12
                        0
                        • A ARASHz4
                          9 May 2016, 17:53

                          @mrjj yes I think

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on 9 May 2016, 18:12 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 9 May 2016, 18:13
                          0
                          • ? A Former User
                            9 May 2016, 18:12

                            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 9 May 2016, 18:13 last edited by
                            #13

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

                            A 1 Reply Last reply 9 May 2016, 18:29
                            0
                            • ? Offline
                              ? Offline
                              A Former User
                              wrote on 9 May 2016, 18:17 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
                                9 May 2016, 18:13

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

                                A Offline
                                A Offline
                                ARASHz4
                                wrote on 9 May 2016, 18:29 last edited by
                                #15

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

                                1 Reply Last reply
                                0
                                • A ARASHz4
                                  9 May 2016, 17:53

                                  @mrjj yes I think

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 9 May 2016, 18:30 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 9 May 2016, 18:31
                                  1
                                  • M mrjj
                                    9 May 2016, 18:30

                                    @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 9 May 2016, 18:31 last edited by
                                    #17

                                    @mrjj Guter Mann. ;-)

                                    1 Reply Last reply
                                    1
                                    • M mrjj
                                      9 May 2016, 18:30

                                      @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 9 May 2016, 18:42 last edited by ARASHz4 5 Sept 2016, 18:43
                                      #18

                                      @mrjj DownloadManager is a private member in downloader.h

                                      1 Reply Last reply
                                      0
                                      • M mrjj
                                        9 May 2016, 18:30

                                        @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 9 May 2016, 18:47 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 8 Sept 2019, 08:42 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