PDA

View Full Version : QXmlStreamWriter / QIODevice Error Handling



ChrisW67
16th July 2010, 02:01
I'm looking at the QXmlStream bookmarks example (http://doc.trolltech.com/4.6/xml-streambookmarks.html) 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

ChrisW67
19th July 2010, 00:57
I gather from the deafening silence that there is no other mechanism.