From 178bc49ac2b80b80f75829f3add5d7e66fd08240 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 5 Oct 2018 23:26:08 +0200 Subject: QImageWriter: improve documentation regarding use of resources QImageWriter's plugin can open devices while operating and only free them on destruction which means that if one wants to act on the file written if must first destroy the writer's instance. This patch adds the suggestion to use a scope to avoid that problem. Change-Id: I239157ea86c4a93faab237fe1860312a3c7ac7a2 Reviewed-by: Eirik Aavitsland --- src/gui/image/qimagewriter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/gui/image/qimagewriter.cpp') diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 5ce7e309bb..d3f9a9b881 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -71,6 +71,16 @@ formats, in addition to any image format plugins that support writing. + \note QImageWriter assumes exclusive control over the file or + device that is assigned. Any attempts to modify the assigned file + or device during the lifetime of the QImageWriter object will + yield undefined results. If immediate access to a resource is + desired, the use of a scope is the recommended method. + + For example: + + \snippet qimagewriter/main.cpp 0 + \sa QImageReader, QImageIOHandler, QImageIOPlugin */ -- cgit v1.2.3