Results 1 to 2 of 2

Thread: QXmlStreamWriter / QIODevice Error Handling

  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Question QXmlStreamWriter / QIODevice Error Handling

    I'm looking at the QXmlStream bookmarks example in particular the writeFile() method. There's no error handling code to be seen in the example and it will always return true.

    In the real world, people try to save things to full (or unwriteable) locations. I assume in an out-of-space situation that the QIODevice will close (although I don't see that in the docs) and emits aboutToClose() as it does so. There does not seem to be any way to detect or handle an error other than:
    • connecting to the aboutToClose() signal to set an internal abort flag which you have to check periodically, or
    • check the device is still open after every operation that might write.

    Am I missing some other/proper/overall error handling mechanism?

    Cheers,
    Chris

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QXmlStreamWriter / QIODevice Error Handling

    I gather from the deafening silence that there is no other mechanism.

Similar Threads

  1. Suggested Error Handling
    By Max Yaffe in forum Qt Programming
    Replies: 6
    Last Post: 15th July 2014, 17:29
  2. Error handling guidelines?
    By bitflyer in forum Newbie
    Replies: 1
    Last Post: 2nd June 2010, 16:09
  3. QThread Error Handling
    By TheJim01 in forum Newbie
    Replies: 2
    Last Post: 8th April 2010, 14:54
  4. QNetworkReply error handling
    By timmu in forum Qt Programming
    Replies: 5
    Last Post: 25th August 2009, 09:07
  5. QIODevice::bytesAvaiable() - error value!
    By kuzulis in forum Qt Programming
    Replies: 4
    Last Post: 24th May 2009, 16:04

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.