Results 1 to 16 of 16

Thread: QHttp in thread (QT4)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QHttp in thread (QT4)

    Quote Originally Posted by maxpower View Post
    Well, I thought I needed to close the file properly to ensure my program did not keep it open. Is that not true?
    It's true (although it's possible that QHttp closes it itself), but here you create a new file object instead of closing the one already open. You should get a pointer to a QIODevice you assigned when making the request and call close on it.

    I moved the code I had before into a done slot and now I do not see that debug error any more. i will have to keep an eye on it to ensure that it does not return.
    It shouldn't unless you start deleting the signalling object from a slot again.

    I can not simply look up the request id in my table to ensure I am working on the correct entry since there could be duplicates, right?):
    Every id is unique per object, so the pair (QHttp*, id) can't duplicate.

    BTW. If you make a qobject_cast, you should check if it doesn't return 0. If you're sure that it is a QHttp* (like in this case), you can make a static_cast instead.

    Qt Code:
    1. int index = httpPointers.indexOf(sendHttp);
    2. httpPointers.removeAt(index);
    To copy to clipboard, switch view to plain text mode 
    I think you can (but don't have to - your code should be slightly faster) substitute it with:
    Qt Code:
    1. httpPointers.removeAll(sendHttp);
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to wysota for this useful post:

    maxpower (19th February 2007)

Similar Threads

  1. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  2. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02
  3. [QT4] QThread and printing a QList<QPixmap>
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 21:44
  4. Are QHttp n QHttpRequestHeader thread safe?
    By Shambhavi in forum Qt Programming
    Replies: 4
    Last Post: 21st January 2006, 08:33
  5. Replies: 2
    Last Post: 6th January 2006, 21:15

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.