Results 1 to 2 of 2

Thread: Problem with QNetworkReply::abort()

  1. #1
    Join Date
    Sep 2011
    Posts
    20
    Qt products
    Qt5
    Platforms
    Windows

    Default Problem with QNetworkReply::abort()

    I have this class called HttpDownload Header / Source. It's basically a simple wrapper for QNetworkReply. The objects are created here when the user wants to open a new network link via the OpenDialog. That HttpDownload is then started here by calling its start method and added to a model that outputs to a QListView using a custom delegate. The QListView displays a progress bar for each HttpDownload which reports its progress via the model. It works. But if I then add another context menu here that lets you stop HttpDownload by calling a new method download->abort() whose implementation goes like this:

    Qt Code:
    1. void HttpDownload::abort()
    2. {
    3. if(reply->isFinished()) {
    4. return;
    5. }
    6.  
    7. reply->abort();
    8.  
    9. emit updated();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Well that works too, however, after I've aborted one HttpDownload, all subsequent HttpDownloads won't start downloading. At all. They do nothing. So when I call the start method here, it won't start downloading. Any ideas? I've tried replacing reply->abort() with reply->close() but it does the same thing. Thanks.

  2. #2
    Join Date
    Sep 2011
    Posts
    20
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Problem with QNetworkReply::abort()

    The problem seems to have fixed itself.Here's the code for the abort feature. It's exactly the same as before so I've no idea why it wasn't working earlier. I just took it from git stash today and tried again and it worked.

    (I didn't see an edit button so I made a new post).

Similar Threads

  1. QNetworkReply doesn't abort/close - PyQT
    By dan252 in forum Qt Programming
    Replies: 1
    Last Post: 7th May 2013, 01:41
  2. the pure virtual method "abort" in QNetworkReply
    By mavenlin in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2011, 11:01
  3. QNetworkReply::deleteLater problem
    By TorAn in forum Qt Programming
    Replies: 5
    Last Post: 29th August 2010, 23:17
  4. Replies: 10
    Last Post: 15th January 2010, 00:55
  5. QNetworkReply::abort crash
    By danc81 in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 12:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.