<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qpicture.cpp --> <title>QPictureIO Class | Qt GUI 5.11</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QPictureIO</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QPictureIO Class</h1> <!-- $$$QPictureIO-brief --> <p>The <a href="qpictureio.html">QPictureIO</a> class contains parameters for loading and saving pictures. <a href="#details">More...</a></p> <!-- @@@QPictureIO --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QPictureIO></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr></table></div><p><b>This class is obsolete.</b> It is provided to keep old source code working. We strongly advise against using it in new code.</p> <ul> <li><a href="qpictureio-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#QPictureIO">QPictureIO</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#QPictureIO-1">QPictureIO</a></b>(QIODevice *<i>ioDevice</i>, const char *<i>format</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#QPictureIO-2">QPictureIO</a></b>(const QString &<i>fileName</i>, const char *<i>format</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#dtor.QPictureIO">~QPictureIO</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#description">description</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#fileName">fileName</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#format">format</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> float </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#gamma">gamma</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QIODevice *</td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#ioDevice">ioDevice</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#parameters">parameters</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPicture &</td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#picture">picture</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#quality">quality</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#read">read</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setDescription">setDescription</a></b>(const QString &<i>description</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setFileName">setFileName</a></b>(const QString &<i>fileName</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setFormat">setFormat</a></b>(const char *<i>format</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setGamma">setGamma</a></b>(float <i>gamma</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setIODevice">setIODevice</a></b>(QIODevice *<i>ioDevice</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setParameters">setParameters</a></b>(const char *<i>parameters</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setPicture">setPicture</a></b>(const QPicture &<i>picture</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setQuality">setQuality</a></b>(int <i>q</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#setStatus">setStatus</a></b>(int <i>status</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#status">status</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#write">write</a></b>()</td></tr> </table></div> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#defineIOHandler">defineIOHandler</a></b>(const char *<i>format</i>, const char *<i>header</i>, const char *<i>flags</i>, picture_io_handler <i>readPicture</i>, picture_io_handler <i>writePicture</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QByteArray> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#inputFormats">inputFormats</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QByteArray> </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#outputFormats">outputFormats</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#pictureFormat">pictureFormat</a></b>(const QString &<i>fileName</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qpictureio.html#pictureFormat-1">pictureFormat</a></b>(QIODevice *<i>d</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QPictureIO-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qpictureio.html">QPictureIO</a> class contains parameters for loading and saving pictures.</p> <p><a href="qpictureio.html">QPictureIO</a> contains a <a href="../qtcore/qiodevice.html">QIODevice</a> object that is used for picture data I/O. The programmer can install new picture file formats in addition to those that Qt provides.</p> <p>You don't normally need to use this class; <a href="qpicture.html#load">QPicture::load</a>(), <a href="qpicture.html#save">QPicture::save</a>().</p> </div> <p><b>See also </b><a href="qpicture.html">QPicture</a>, <a href="qpixmap.html">QPixmap</a>, and <a href="../qtcore/qfile.html">QFile</a>.</p> <!-- @@@QPictureIO --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QPictureIO[overload1]$$$QPictureIO --> <h3 class="fn" id="QPictureIO"><a name="QPictureIO"></a>QPictureIO::<span class="name">QPictureIO</span>()</h3> <p>Constructs a <a href="qpictureio.html" class="obsolete">QPictureIO</a> object with all parameters set to zero.</p> <!-- @@@QPictureIO --> <!-- $$$QPictureIO$$$QPictureIOQIODevice*constchar* --> <h3 class="fn" id="QPictureIO-1"><a name="QPictureIO-1"></a>QPictureIO::<span class="name">QPictureIO</span>(<span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *<i>ioDevice</i>, const <span class="type">char</span> *<i>format</i>)</h3> <p>Constructs a <a href="qpictureio.html" class="obsolete">QPictureIO</a> object with the I/O device <i>ioDevice</i> and a <i>format</i> tag.</p> <!-- @@@QPictureIO --> <!-- $$$QPictureIO$$$QPictureIOconstQString&constchar* --> <h3 class="fn" id="QPictureIO-2"><a name="QPictureIO-2"></a>QPictureIO::<span class="name">QPictureIO</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>fileName</i>, const <span class="type">char</span> *<i>format</i>)</h3> <p>Constructs a <a href="qpictureio.html" class="obsolete">QPictureIO</a> object with the file name <i>fileName</i> and a <i>format</i> tag.</p> <!-- @@@QPictureIO --> <!-- $$$~QPictureIO[overload1]$$$~QPictureIO --> <h3 class="fn" id="dtor.QPictureIO"><a name="dtor.QPictureIO"></a>QPictureIO::<span class="name">~QPictureIO</span>()</h3> <p>Destroys the object and all related data.</p> <!-- @@@~QPictureIO --> <!-- $$$defineIOHandler[overload1]$$$defineIOHandlerconstchar*constchar*constchar*picture_io_handlerpicture_io_handler --> <h3 class="fn" id="defineIOHandler"><a name="defineIOHandler"></a><code>[static] </code><span class="type">void</span> QPictureIO::<span class="name">defineIOHandler</span>(const <span class="type">char</span> *<i>format</i>, const <span class="type">char</span> *<i>header</i>, const <span class="type">char</span> *<i>flags</i>, <span class="type">picture_io_handler</span> <i>readPicture</i>, <span class="type">picture_io_handler</span> <i>writePicture</i>)</h3> <p>Defines a picture I/O handler for the picture format called <i>format</i>, which is recognized using the regular expression defined in <i>header</i>, read using <i>readPicture</i> and written using <i>writePicture</i>.</p> <p><i>flags</i> is a string of single-character flags for this format. The only flag defined currently is T (upper case), so the only legal value for <i>flags</i> are "T" and the empty string. The "T" flag means that the picture file is a text file, and Qt should treat all newline conventions as equivalent. (XPM files and some PPM files are text files for example.)</p> <p><i>format</i> is used to select a handler to write a <a href="qpicture.html">QPicture</a>; <i>header</i> is used to select a handler to read an picture file.</p> <p>If <i>readPicture</i> is a null pointer, the <a href="qpictureio.html" class="obsolete">QPictureIO</a> will not be able to read pictures in <i>format</i>. If <i>writePicture</i> is a null pointer, the <a href="qpictureio.html" class="obsolete">QPictureIO</a> will not be able to write pictures in <i>format</i>. If both are null, the <a href="qpictureio.html" class="obsolete">QPictureIO</a> object is valid but useless.</p> <p>Example:</p> <pre class="cpp"> <span class="type">void</span> readSVG(<span class="type"><a href="qpictureio.html#QPictureIO">QPictureIO</a></span> <span class="operator">*</span>picture) { <span class="comment">// read the picture using the picture->ioDevice()</span> } <span class="type">void</span> writeSVG(<span class="type"><a href="qpictureio.html#QPictureIO">QPictureIO</a></span> <span class="operator">*</span>picture) { <span class="comment">// write the picture using the picture->ioDevice()</span> } <span class="comment">// add the SVG picture handler</span> <span class="comment">// ...</span> </pre> <p>Before the regular expression test, all the 0 bytes in the file header are converted to 1 bytes. This is done because when Qt was ASCII-based, <a href="../qtcore/qregexp.html">QRegExp</a> could not handle 0 bytes in strings.</p> <p>The regexp is only applied on the first 14 bytes of the file.</p> <p>(Note that if one handlerIO supports writing a format and another supports reading it, Qt supports both reading and writing. If two handlers support the same operation, Qt chooses one arbitrarily.)</p> <!-- @@@defineIOHandler --> <!-- $$$description[overload1]$$$description --> <h3 class="fn" id="description"><a name="description"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPictureIO::<span class="name">description</span>() const</h3> <p>Returns the picture description string.</p> <p><b>See also </b><a href="qpictureio.html#setDescription">setDescription</a>().</p> <!-- @@@description --> <!-- $$$fileName[overload1]$$$fileName --> <h3 class="fn" id="fileName"><a name="fileName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPictureIO::<span class="name">fileName</span>() const</h3> <p>Returns the file name currently set.</p> <p><b>See also </b><a href="qpictureio.html#setFileName">setFileName</a>().</p> <!-- @@@fileName --> <!-- $$$format[overload1]$$$format --> <h3 class="fn" id="format"><a name="format"></a>const <span class="type">char</span> *QPictureIO::<span class="name">format</span>() const</h3> <p>Returns the picture format string or 0 if no format has been explicitly set.</p> <p><b>See also </b><a href="qpictureio.html#setFormat">setFormat</a>().</p> <!-- @@@format --> <!-- $$$gamma[overload1]$$$gamma --> <h3 class="fn" id="gamma"><a name="gamma"></a><span class="type">float</span> QPictureIO::<span class="name">gamma</span>() const</h3> <p>Returns the gamma value at which the picture will be viewed.</p> <p><b>See also </b><a href="qpictureio.html#setGamma">setGamma</a>().</p> <!-- @@@gamma --> <!-- $$$inputFormats[overload1]$$$inputFormats --> <h3 class="fn" id="inputFormats"><a name="inputFormats"></a><code>[static] </code><span class="type">QList</span><<span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>> QPictureIO::<span class="name">inputFormats</span>()</h3> <p>Returns a sorted list of picture formats that are supported for picture input.</p> <!-- @@@inputFormats --> <!-- $$$ioDevice[overload1]$$$ioDevice --> <h3 class="fn" id="ioDevice"><a name="ioDevice"></a><span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *QPictureIO::<span class="name">ioDevice</span>() const</h3> <p>Returns the IO device currently set.</p> <p><b>See also </b><a href="qpictureio.html#setIODevice">setIODevice</a>().</p> <!-- @@@ioDevice --> <!-- $$$outputFormats[overload1]$$$outputFormats --> <h3 class="fn" id="outputFormats"><a name="outputFormats"></a><code>[static] </code><span class="type">QList</span><<span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>> QPictureIO::<span class="name">outputFormats</span>()</h3> <p>Returns a sorted list of picture formats that are supported for picture output.</p> <!-- @@@outputFormats --> <!-- $$$parameters[overload1]$$$parameters --> <h3 class="fn" id="parameters"><a name="parameters"></a>const <span class="type">char</span> *QPictureIO::<span class="name">parameters</span>() const</h3> <p>Returns the picture's parameters string.</p> <p><b>See also </b><a href="qpictureio.html#setParameters">setParameters</a>().</p> <!-- @@@parameters --> <!-- $$$picture[overload1]$$$picture --> <h3 class="fn" id="picture"><a name="picture"></a>const <span class="type"><a href="qpicture.html">QPicture</a></span> &QPictureIO::<span class="name">picture</span>() const</h3> <p>Returns the picture currently set.</p> <p><b>See also </b><a href="qpictureio.html#setPicture">setPicture</a>().</p> <!-- @@@picture --> <!-- $$$pictureFormat[overload1]$$$pictureFormatconstQString& --> <h3 class="fn" id="pictureFormat"><a name="pictureFormat"></a><code>[static] </code><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QPictureIO::<span class="name">pictureFormat</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>fileName</i>)</h3> <p>Returns a string that specifies the picture format of the file <i>fileName</i>, or null if the file cannot be read or if the format is not recognized.</p> <!-- @@@pictureFormat --> <!-- $$$pictureFormat$$$pictureFormatQIODevice* --> <h3 class="fn" id="pictureFormat-1"><a name="pictureFormat-1"></a><code>[static] </code><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QPictureIO::<span class="name">pictureFormat</span>(<span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *<i>d</i>)</h3> <p>This is an overloaded function.</p> <p>Returns a string that specifies the picture format of the picture read from IO device <i>d</i>, or 0 if the device cannot be read or if the format is not recognized.</p> <p>Make sure that <i>d</i> is at the right position in the device (for example, at the beginning of the file).</p> <p><b>See also </b><a href="../qtcore/qiodevice.html#pos">QIODevice::pos</a>().</p> <!-- @@@pictureFormat --> <!-- $$$quality[overload1]$$$quality --> <h3 class="fn" id="quality"><a name="quality"></a><span class="type">int</span> QPictureIO::<span class="name">quality</span>() const</h3> <p>Returns the quality of the written picture, related to the compression ratio.</p> <p><b>See also </b><a href="qpictureio.html#setQuality">setQuality</a>() and <a href="qpicture.html#save">QPicture::save</a>().</p> <!-- @@@quality --> <!-- $$$read[overload1]$$$read --> <h3 class="fn" id="read"><a name="read"></a><span class="type">bool</span> QPictureIO::<span class="name">read</span>()</h3> <p>Reads an picture into memory and returns <code>true</code> if the picture was successfully read; otherwise returns <code>false</code>.</p> <p>Before reading an picture you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used.</p> <p>Setting the picture file format string is optional.</p> <p>Note that this function does <i>not</i> set the <a href="qpictureio.html#format">format</a> used to read the picture. If you need that information, use the <a href="qpictureio.html#pictureFormat">pictureFormat</a>() static functions.</p> <p>Example:</p> <pre class="cpp"> <span class="type"><a href="qpictureio.html#QPictureIO">QPictureIO</a></span> iio; <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap; iio<span class="operator">.</span>setFileName(<span class="string">"vegeburger.pic"</span>); <span class="keyword">if</span> (iio<span class="operator">.</span>read()) { <span class="comment">// OK</span> <span class="type"><a href="qpicture.html">QPicture</a></span> picture <span class="operator">=</span> iio<span class="operator">.</span>picture(); <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="operator">&</span>pixmap); painter<span class="operator">.</span>drawPicture(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> picture); } </pre> <p><b>See also </b><a href="qpictureio.html#setIODevice">setIODevice</a>(), <a href="qpictureio.html#setFileName">setFileName</a>(), <a href="qpictureio.html#setFormat">setFormat</a>(), <a href="qpictureio.html#write">write</a>(), and <a href="qpixmap.html#load">QPixmap::load</a>().</p> <!-- @@@read --> <!-- $$$setDescription[overload1]$$$setDescriptionconstQString& --> <h3 class="fn" id="setDescription"><a name="setDescription"></a><span class="type">void</span> QPictureIO::<span class="name">setDescription</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>description</i>)</h3> <p>Sets the picture description string for picture handlers that support picture descriptions to <i>description</i>.</p> <p>Currently, no picture format supported by Qt uses the description string.</p> <p><b>See also </b><a href="qpictureio.html#description">description</a>().</p> <!-- @@@setDescription --> <!-- $$$setFileName[overload1]$$$setFileNameconstQString& --> <h3 class="fn" id="setFileName"><a name="setFileName"></a><span class="type">void</span> QPictureIO::<span class="name">setFileName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>fileName</i>)</h3> <p>Sets the name of the file to read or write an picture from to <i>fileName</i>.</p> <p><b>See also </b><a href="qpictureio.html#fileName">fileName</a>() and <a href="qpictureio.html#setIODevice">setIODevice</a>().</p> <!-- @@@setFileName --> <!-- $$$setFormat[overload1]$$$setFormatconstchar* --> <h3 class="fn" id="setFormat"><a name="setFormat"></a><span class="type">void</span> QPictureIO::<span class="name">setFormat</span>(const <span class="type">char</span> *<i>format</i>)</h3> <p>Sets the picture format to <i>format</i> for the picture to be read or written.</p> <p>It is necessary to specify a format before writing an picture, but it is not necessary to specify a format before reading an picture.</p> <p>If no format has been set, Qt guesses the picture format before reading it. If a format is set the picture will only be read if it has that format.</p> <p><b>See also </b><a href="qpictureio.html#read">read</a>(), <a href="qpictureio.html#write">write</a>(), and <a href="qpictureio.html#format">format</a>().</p> <!-- @@@setFormat --> <!-- $$$setGamma[overload1]$$$setGammafloat --> <h3 class="fn" id="setGamma"><a name="setGamma"></a><span class="type">void</span> QPictureIO::<span class="name">setGamma</span>(<span class="type">float</span> <i>gamma</i>)</h3> <p>Sets the gamma value at which the picture will be viewed to <i>gamma</i>. If the picture format stores a gamma value for which the picture is intended to be used, then this setting will be used to modify the picture. Setting to 0.0 will disable gamma correction (i.e. any specification in the file will be ignored).</p> <p>The default value is 0.0.</p> <p><b>See also </b><a href="qpictureio.html#gamma">gamma</a>().</p> <!-- @@@setGamma --> <!-- $$$setIODevice[overload1]$$$setIODeviceQIODevice* --> <h3 class="fn" id="setIODevice"><a name="setIODevice"></a><span class="type">void</span> QPictureIO::<span class="name">setIODevice</span>(<span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *<i>ioDevice</i>)</h3> <p>Sets the IO device to be used for reading or writing an picture.</p> <p>Setting the IO device allows pictures to be read/written to any block-oriented <a href="../qtcore/qiodevice.html">QIODevice</a>.</p> <p>If <i>ioDevice</i> is not null, this IO device will override file name settings.</p> <p><b>See also </b><a href="qpictureio.html#setFileName">setFileName</a>().</p> <!-- @@@setIODevice --> <!-- $$$setParameters[overload1]$$$setParametersconstchar* --> <h3 class="fn" id="setParameters"><a name="setParameters"></a><span class="type">void</span> QPictureIO::<span class="name">setParameters</span>(const <span class="type">char</span> *<i>parameters</i>)</h3> <p>Sets the picture's parameter string to <i>parameters</i>. This is for picture handlers that require special parameters.</p> <p>Although the current picture formats supported by Qt ignore the parameters string, it may be used in future extensions or by contributions (for example, JPEG).</p> <p><b>See also </b><a href="qpictureio.html#parameters">parameters</a>().</p> <!-- @@@setParameters --> <!-- $$$setPicture[overload1]$$$setPictureconstQPicture& --> <h3 class="fn" id="setPicture"><a name="setPicture"></a><span class="type">void</span> QPictureIO::<span class="name">setPicture</span>(const <span class="type"><a href="qpicture.html">QPicture</a></span> &<i>picture</i>)</h3> <p>Sets the picture to <i>picture</i>.</p> <p><b>See also </b><a href="qpictureio.html#picture">picture</a>().</p> <!-- @@@setPicture --> <!-- $$$setQuality[overload1]$$$setQualityint --> <h3 class="fn" id="setQuality"><a name="setQuality"></a><span class="type">void</span> QPictureIO::<span class="name">setQuality</span>(<span class="type">int</span> <i>q</i>)</h3> <p>Sets the quality of the written picture to <i>q</i>, related to the compression ratio.</p> <p><i>q</i> must be in the range -1..100. Specify 0 to obtain small compressed files, 100 for large uncompressed files. (-1 signifies the default compression.)</p> <p><b>See also </b><a href="qpictureio.html#quality">quality</a>() and <a href="qpicture.html#save">QPicture::save</a>().</p> <!-- @@@setQuality --> <!-- $$$setStatus[overload1]$$$setStatusint --> <h3 class="fn" id="setStatus"><a name="setStatus"></a><span class="type">void</span> QPictureIO::<span class="name">setStatus</span>(<span class="type">int</span> <i>status</i>)</h3> <p>Sets the picture IO status to <i>status</i>. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.</p> <p><b>See also </b><a href="qpictureio.html#status">status</a>().</p> <!-- @@@setStatus --> <!-- $$$status[overload1]$$$status --> <h3 class="fn" id="status"><a name="status"></a><span class="type">int</span> QPictureIO::<span class="name">status</span>() const</h3> <p>Returns the picture's IO status. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.</p> <p><b>See also </b><a href="qpictureio.html#setStatus">setStatus</a>().</p> <!-- @@@status --> <!-- $$$write[overload1]$$$write --> <h3 class="fn" id="write"><a name="write"></a><span class="type">bool</span> QPictureIO::<span class="name">write</span>()</h3> <p>Writes an picture to an IO device and returns <code>true</code> if the picture was successfully written; otherwise returns <code>false</code>.</p> <p>Before writing an picture you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used.</p> <p>The picture will be written using the specified picture format.</p> <p>Example:</p> <pre class="cpp"> <span class="type"><a href="qpictureio.html#QPictureIO">QPictureIO</a></span> iio; <span class="type"><a href="qpicture.html">QPicture</a></span> picture; <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="operator">&</span>picture); painter<span class="operator">.</span>drawPixmap(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> pixmap); iio<span class="operator">.</span>setPicture(picture); iio<span class="operator">.</span>setFileName(<span class="string">"vegeburger.pic"</span>); iio<span class="operator">.</span>setFormat(<span class="string">"PIC"</span>); <span class="keyword">if</span> (iio<span class="operator">.</span>write()) <span class="keyword">return</span> <span class="keyword">true</span>; <span class="comment">// returned true if written successfully</span> </pre> <p><b>See also </b><a href="qpictureio.html#setIODevice">setIODevice</a>(), <a href="qpictureio.html#setFileName">setFileName</a>(), <a href="qpictureio.html#setFormat">setFormat</a>(), <a href="qpictureio.html#read">read</a>(), and <a href="qpixmap.html#save">QPixmap::save</a>().</p> <!-- @@@write --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>