Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 5567

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qimagereader.cpp -->
  <title>Qt 4.8: QImageReader Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QImageReader</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<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>
<h1 class="title">QImageReader Class Reference</h1>
<!-- $$$QImageReader-brief -->
<p>The QImageReader class provides a format independent interface for reading images from files or other devices. <a href="#details">More...</a></p>
<!-- @@@QImageReader -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QImageReader&gt;</span></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qimagereader-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a></b> { FileNotFoundError, DeviceError, UnsupportedFormatError, InvalidDataError, UnknownError }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#QImageReader">QImageReader</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#QImageReader-2">QImageReader</a></b> ( QIODevice * <i>device</i>, const QByteArray &amp; <i>format</i> = QByteArray() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#QImageReader-3">QImageReader</a></b> ( const QString &amp; <i>fileName</i>, const QByteArray &amp; <i>format</i> = QByteArray() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#dtor.QImageReader">~QImageReader</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#autoDetectImageFormat">autoDetectImageFormat</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#backgroundColor">backgroundColor</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#canRead">canRead</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#clipRect">clipRect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#currentImageNumber">currentImageNumber</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#currentImageRect">currentImageRect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#decideFormatFromContent">decideFormatFromContent</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIODevice * </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#device">device</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ImageReaderError </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#error">error</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#fileName">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#format">format</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#imageCount">imageCount</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage::Format </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#imageFormat">imageFormat</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#jumpToImage">jumpToImage</a></b> ( int <i>imageNumber</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#jumpToNextImage">jumpToNextImage</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#loopCount">loopCount</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#nextImageDelay">nextImageDelay</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#quality">quality</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#read">read</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#read-2">read</a></b> ( QImage * <i>image</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#scaledClipRect">scaledClipRect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#scaledSize">scaledSize</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setAutoDetectImageFormat">setAutoDetectImageFormat</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setBackgroundColor">setBackgroundColor</a></b> ( const QColor &amp; <i>color</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setClipRect">setClipRect</a></b> ( const QRect &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setDecideFormatFromContent">setDecideFormatFromContent</a></b> ( bool <i>ignored</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setDevice">setDevice</a></b> ( QIODevice * <i>device</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setFileName">setFileName</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setFormat">setFormat</a></b> ( const QByteArray &amp; <i>format</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setQuality">setQuality</a></b> ( int <i>quality</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a></b> ( const QRect &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#setScaledSize">setScaledSize</a></b> ( const QSize &amp; <i>size</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#supportsOption">supportsOption</a></b> ( QImageIOHandler::ImageOption <i>option</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#text">text</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#textKeys">textKeys</a></b> () const</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#imageFormat-2">imageFormat</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#imageFormat-3">imageFormat</a></b> ( QIODevice * <i>device</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a></b> ()</td></tr>
</table>
<a name="details"></a>
<!-- $$$QImageReader-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QImageReader class provides a format independent interface for reading images from files or other devices.</p>
<p>The most common way to read images is through <a href="qimage.html">QImage</a> and <a href="qpixmap.html">QPixmap</a>'s constructors, or by calling <a href="qimage.html#load">QImage::load</a>() and <a href="qpixmap.html#load">QPixmap::load</a>(). QImageReader is a specialized class which gives you more control when reading images. For example, you can read an image into a specific size by calling <a href="qimagereader.html#setScaledSize">setScaledSize</a>(), and you can select a clip rect, effectively loading only parts of an image, by calling <a href="qimagereader.html#setClipRect">setClipRect</a>(). Depending on the underlying support in the image format, this can save memory and speed up loading of images.</p>
<p>To read an image, you start by constructing a QImageReader object. Pass either a file name or a device pointer, and the image format to QImageReader's constructor. You can then set several options, such as the clip rect (by calling <a href="qimagereader.html#setClipRect">setClipRect</a>()) and scaled size (by calling <a href="qimagereader.html#setScaledSize">setScaledSize</a>()). <a href="qimagereader.html#canRead">canRead</a>() returns the image if the QImageReader can read the image (i.e&#x2e;, the image format is supported and the device is open for reading). Call <a href="qimagereader.html#read">read</a>() to read the image.</p>
<p>If any error occurs when reading the image, <a href="qimagereader.html#read">read</a>() will return a null <a href="qimage.html">QImage</a>. You can then call <a href="qimagereader.html#error">error</a>() to find the type of error that occurred, or <a href="qimagereader.html#errorString">errorString</a>() to get a human readable description of what went wrong.</p>
<p>Call <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>() for a list of formats that QImageReader can read. QImageReader supports all built-in image formats, in addition to any image format plugins that support reading.</p>
<p>QImageReader autodetects the image format by default, by looking at the provided (optional) format string, the file name suffix, and the data stream contents. You can enable or disable this feature, by calling <a href="qimagereader.html#setAutoDetectImageFormat">setAutoDetectImageFormat</a>().</p>
</div>
<p><b>See also </b><a href="qimagewriter.html">QImageWriter</a>, <a href="qimageiohandler.html">QImageIOHandler</a>, and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<!-- @@@QImageReader -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ImageReaderError$$$UnknownError$$$FileNotFoundError$$$DeviceError$$$UnsupportedFormatError$$$InvalidDataError -->
<h3 class="fn"><a name="ImageReaderError-enum"></a>enum QImageReader::<span class="name">ImageReaderError</span></h3>
<p>This enum describes the different types of errors that can occur when reading images with <a href="qimagereader.html">QImageReader</a>.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QImageReader::FileNotFoundError</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign"><a href="qimagereader.html">QImageReader</a> was used with a file name, but not file was found with that name. This can also happen if the file name contained no extension, and the file with the correct extension is not supported by Qt.</td></tr>
<tr><td class="topAlign"><tt>QImageReader::DeviceError</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign"><a href="qimagereader.html">QImageReader</a> encountered a device error when reading the image. You can consult your particular device for more details on what went wrong.</td></tr>
<tr><td class="topAlign"><tt>QImageReader::UnsupportedFormatError</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">Qt does not support the requested image format.</td></tr>
<tr><td class="topAlign"><tt>QImageReader::InvalidDataError</tt></td><td class="topAlign"><tt>4</tt></td><td class="topAlign">The image data was invalid, and <a href="qimagereader.html">QImageReader</a> was unable to read an image from it. The can happen if the image file is damaged.</td></tr>
<tr><td class="topAlign"><tt>QImageReader::UnknownError</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">An unknown error occurred. If you get this value after calling <a href="qimagereader.html#read">read</a>(), it is most likely caused by a bug in <a href="qimagereader.html">QImageReader</a>.</td></tr>
</table>
<!-- @@@ImageReaderError -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QImageReader[overload1]$$$QImageReader -->
<h3 class="fn"><a name="QImageReader"></a>QImageReader::<span class="name">QImageReader</span> ()</h3>
<p>Constructs an empty <a href="qimagereader.html">QImageReader</a> object. Before reading an image, call <a href="qimagereader.html#setDevice">setDevice</a>() or <a href="qimagereader.html#setFileName">setFileName</a>().</p>
<!-- @@@QImageReader -->
<!-- $$$QImageReader$$$QImageReaderQIODevice*constQByteArray& -->
<h3 class="fn"><a name="QImageReader-2"></a>QImageReader::<span class="name">QImageReader</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>device</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> = QByteArray() )</h3>
<p>Constructs a <a href="qimagereader.html">QImageReader</a> object with the device <i>device</i> and the image format <i>format</i>.</p>
<!-- @@@QImageReader -->
<!-- $$$QImageReader$$$QImageReaderconstQString&constQByteArray& -->
<h3 class="fn"><a name="QImageReader-3"></a>QImageReader::<span class="name">QImageReader</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> = QByteArray() )</h3>
<p>Constructs a <a href="qimagereader.html">QImageReader</a> object with the file name <i>fileName</i> and the image format <i>format</i>.</p>
<p><b>See also </b><a href="qimagereader.html#setFileName">setFileName</a>().</p>
<!-- @@@QImageReader -->
<!-- $$$~QImageReader[overload1]$$$~QImageReader -->
<h3 class="fn"><a name="dtor.QImageReader"></a>QImageReader::<span class="name">~QImageReader</span> ()</h3>
<p>Destructs the <a href="qimagereader.html">QImageReader</a> object.</p>
<!-- @@@~QImageReader -->
<!-- $$$autoDetectImageFormat[overload1]$$$autoDetectImageFormat -->
<h3 class="fn"><a name="autoDetectImageFormat"></a><span class="type">bool</span> QImageReader::<span class="name">autoDetectImageFormat</span> () const</h3>
<p>Returns true if image format autodetection is enabled on this image reader; otherwise returns false. By default, autodetection is enabled.</p>
<p><b>See also </b><a href="qimagereader.html#setAutoDetectImageFormat">setAutoDetectImageFormat</a>().</p>
<!-- @@@autoDetectImageFormat -->
<!-- $$$backgroundColor[overload1]$$$backgroundColor -->
<h3 class="fn"><a name="backgroundColor"></a><span class="type"><a href="qcolor.html">QColor</a></span> QImageReader::<span class="name">backgroundColor</span> () const</h3>
<p>Returns the background color that's used when reading an image. If the image format does not support setting the background color an invalid color is returned.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimagereader.html#setBackgroundColor">setBackgroundColor</a>() and <a href="qimagereader.html#read">read</a>().</p>
<!-- @@@backgroundColor -->
<!-- $$$canRead[overload1]$$$canRead -->
<h3 class="fn"><a name="canRead"></a><span class="type">bool</span> QImageReader::<span class="name">canRead</span> () const</h3>
<p>Returns true if an image can be read for the device (i.e&#x2e;, the image format is supported, and the device seems to contain valid data); otherwise returns false.</p>
<p>canRead() is a lightweight function that only does a quick test to see if the image data is valid. <a href="qimagereader.html#read">read</a>() may still return false after canRead() returns true, if the image data is corrupt.</p>
<p>For images that support animation, canRead() returns false when all frames have been read.</p>
<p><b>See also </b><a href="qimagereader.html#read">read</a>() and <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>().</p>
<!-- @@@canRead -->
<!-- $$$clipRect[overload1]$$$clipRect -->
<h3 class="fn"><a name="clipRect"></a><span class="type"><a href="qrect.html">QRect</a></span> QImageReader::<span class="name">clipRect</span> () const</h3>
<p>Returns the clip rect (also known as the ROI, or Region Of Interest) of the image. If no clip rect has been set, an invalid <a href="qrect.html">QRect</a> is returned.</p>
<p><b>See also </b><a href="qimagereader.html#setClipRect">setClipRect</a>().</p>
<!-- @@@clipRect -->
<!-- $$$currentImageNumber[overload1]$$$currentImageNumber -->
<h3 class="fn"><a name="currentImageNumber"></a><span class="type">int</span> QImageReader::<span class="name">currentImageNumber</span> () const</h3>
<p>For image formats that support animation, this function returns the sequence number of the current frame. If the image format doesn't support animation, 0 is returned.</p>
<p>This function returns -1 if an error occurred.</p>
<p><b>See also </b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), <a href="qimageiohandler.html#currentImageNumber">QImageIOHandler::currentImageNumber</a>(), and <a href="qimagereader.html#canRead">canRead</a>().</p>
<!-- @@@currentImageNumber -->
<!-- $$$currentImageRect[overload1]$$$currentImageRect -->
<h3 class="fn"><a name="currentImageRect"></a><span class="type"><a href="qrect.html">QRect</a></span> QImageReader::<span class="name">currentImageRect</span> () const</h3>
<p>For image formats that support animation, this function returns the rect for the current frame. Otherwise, a null rect is returned.</p>
<p><b>See also </b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#currentImageRect">QImageIOHandler::currentImageRect</a>().</p>
<!-- @@@currentImageRect -->
<!-- $$$decideFormatFromContent[overload1]$$$decideFormatFromContent -->
<h3 class="fn"><a name="decideFormatFromContent"></a><span class="type">bool</span> QImageReader::<span class="name">decideFormatFromContent</span> () const</h3>
<p>Returns whether the image reader should decide which plugin to use only based on the contents of the datastream rather than on the file extension.</p>
<p><b>See also </b><a href="qimagereader.html#setDecideFormatFromContent">setDecideFormatFromContent</a>().</p>
<!-- @@@decideFormatFromContent -->
<!-- $$$device[overload1]$$$device -->
<h3 class="fn"><a name="device"></a><span class="type"><a href="qiodevice.html">QIODevice</a></span> * QImageReader::<span class="name">device</span> () const</h3>
<p>Returns the device currently assigned to <a href="qimagereader.html">QImageReader</a>, or 0 if no device has been assigned.</p>
<p><b>See also </b><a href="qimagereader.html#setDevice">setDevice</a>().</p>
<!-- @@@device -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a><span class="type"><a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a></span> QImageReader::<span class="name">error</span> () const</h3>
<p>Returns the type of error that occurred last.</p>
<p><b>See also </b><a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a> and <a href="qimagereader.html#errorString">errorString</a>().</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> QImageReader::<span class="name">errorString</span> () const</h3>
<p>Returns a human readable description of the last error that occurred.</p>
<p><b>See also </b><a href="qimagereader.html#error">error</a>().</p>
<!-- @@@errorString -->
<!-- $$$fileName[overload1]$$$fileName -->
<h3 class="fn"><a name="fileName"></a><span class="type"><a href="qstring.html">QString</a></span> QImageReader::<span class="name">fileName</span> () const</h3>
<p>If the currently assigned device is a <a href="qfile.html">QFile</a>, or if <a href="qimagereader.html#setFileName">setFileName</a>() has been called, this function returns the name of the file <a href="qimagereader.html">QImageReader</a> reads from. Otherwise (i.e&#x2e;, if no device has been assigned or the device is not a <a href="qfile.html">QFile</a>), an empty <a href="qstring.html">QString</a> is returned.</p>
<p><b>See also </b><a href="qimagereader.html#setFileName">setFileName</a>() and <a href="qimagereader.html#setDevice">setDevice</a>().</p>
<!-- @@@fileName -->
<!-- $$$format[overload1]$$$format -->
<h3 class="fn"><a name="format"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QImageReader::<span class="name">format</span> () const</h3>
<p>Returns the format <a href="qimagereader.html">QImageReader</a> uses for reading images.</p>
<p>You can call this function after assigning a device to the reader to determine the format of the device. For example:</p>
<pre class="cpp"> <span class="type"><a href="qimagereader.html">QImageReader</a></span> reader(<span class="string">&quot;image.png&quot;</span>);
 <span class="comment">// reader.format() == &quot;png&quot;</span></pre>
<p>If the reader cannot read any image from the device (e.g&#x2e;, there is no image there, or the image has already been read), or if the format is unsupported, this function returns an empty QByteArray().</p>
<p><b>See also </b><a href="qimagereader.html#setFormat">setFormat</a>() and <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>().</p>
<!-- @@@format -->
<!-- $$$imageCount[overload1]$$$imageCount -->
<h3 class="fn"><a name="imageCount"></a><span class="type">int</span> QImageReader::<span class="name">imageCount</span> () const</h3>
<p>For image formats that support animation, this function returns the total number of images in the animation. If the format does not support animation, 0 is returned.</p>
<p>This function returns -1 if an error occurred.</p>
<p><b>See also </b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), <a href="qimageiohandler.html#imageCount">QImageIOHandler::imageCount</a>(), and <a href="qimagereader.html#canRead">canRead</a>().</p>
<!-- @@@imageCount -->
<!-- $$$imageFormat[overload1]$$$imageFormat -->
<h3 class="fn"><a name="imageFormat"></a><span class="type"><a href="qimage.html#Format-enum">QImage::Format</a></span> QImageReader::<span class="name">imageFormat</span> () const</h3>
<p>Returns the format of the image, without actually reading the image contents. The format describes the image format <a href="qimagereader.html#read">QImageReader::read</a>() returns, not the format of the actual image.</p>
<p>If the image format does not support this feature, this function returns an invalid format.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also </b><a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::ImageOption</a>, <a href="qimageiohandler.html#option">QImageIOHandler::option</a>(), and <a href="qimageiohandler.html#supportsOption">QImageIOHandler::supportsOption</a>().</p>
<!-- @@@imageFormat -->
<!-- $$$imageFormat$$$imageFormatconstQString& -->
<h3 class="fn"><a name="imageFormat-2"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QImageReader::<span class="name">imageFormat</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i> )<tt> [static]</tt></h3>
<p>If supported, this function returns the image format of the file <i>fileName</i>. Otherwise, an empty string is returned.</p>
<!-- @@@imageFormat -->
<!-- $$$imageFormat$$$imageFormatQIODevice* -->
<h3 class="fn"><a name="imageFormat-3"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QImageReader::<span class="name">imageFormat</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>device</i> )<tt> [static]</tt></h3>
<p>If supported, this function returns the image format of the device <i>device</i>. Otherwise, an empty string is returned.</p>
<p><b>See also </b><a href="qimagereader.html#autoDetectImageFormat">QImageReader::autoDetectImageFormat</a>().</p>
<!-- @@@imageFormat -->
<!-- $$$jumpToImage[overload1]$$$jumpToImageint -->
<h3 class="fn"><a name="jumpToImage"></a><span class="type">bool</span> QImageReader::<span class="name">jumpToImage</span> ( <span class="type">int</span> <i>imageNumber</i> )</h3>
<p>For image formats that support animation, this function skips to the image whose sequence number is <i>imageNumber</i>, returning true if successful or false if the corresponding image cannot be found.</p>
<p>The next call to <a href="qimagereader.html#read">read</a>() will attempt to read this image.</p>
<p><b>See also </b><a href="qimagereader.html#jumpToNextImage">jumpToNextImage</a>() and <a href="qimageiohandler.html#jumpToImage">QImageIOHandler::jumpToImage</a>().</p>
<!-- @@@jumpToImage -->
<!-- $$$jumpToNextImage[overload1]$$$jumpToNextImage -->
<h3 class="fn"><a name="jumpToNextImage"></a><span class="type">bool</span> QImageReader::<span class="name">jumpToNextImage</span> ()</h3>
<p>For image formats that support animation, this function steps over the current image, returning true if successful or false if there is no following image in the animation.</p>
<p>The default implementation calls <a href="qimagereader.html#read">read</a>(), then discards the resulting image, but the image handler may have a more efficient way of implementing this operation.</p>
<p><b>See also </b><a href="qimagereader.html#jumpToImage">jumpToImage</a>() and <a href="qimageiohandler.html#jumpToNextImage">QImageIOHandler::jumpToNextImage</a>().</p>
<!-- @@@jumpToNextImage -->
<!-- $$$loopCount[overload1]$$$loopCount -->
<h3 class="fn"><a name="loopCount"></a><span class="type">int</span> QImageReader::<span class="name">loopCount</span> () const</h3>
<p>For image formats that support animation, this function returns the number of times the animation should loop. If this function returns -1, it can either mean the animation should loop forever, or that an error occurred. If an error occurred, <a href="qimagereader.html#canRead">canRead</a>() will return false.</p>
<p><b>See also </b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), <a href="qimageiohandler.html#loopCount">QImageIOHandler::loopCount</a>(), and <a href="qimagereader.html#canRead">canRead</a>().</p>
<!-- @@@loopCount -->
<!-- $$$nextImageDelay[overload1]$$$nextImageDelay -->
<h3 class="fn"><a name="nextImageDelay"></a><span class="type">int</span> QImageReader::<span class="name">nextImageDelay</span> () const</h3>
<p>For image formats that support animation, this function returns the number of milliseconds to wait until displaying the next frame in the animation. If the image format doesn't support animation, 0 is returned.</p>
<p>This function returns -1 if an error occurred.</p>
<p><b>See also </b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), <a href="qimageiohandler.html#nextImageDelay">QImageIOHandler::nextImageDelay</a>(), and <a href="qimagereader.html#canRead">canRead</a>().</p>
<!-- @@@nextImageDelay -->
<!-- $$$quality[overload1]$$$quality -->
<h3 class="fn"><a name="quality"></a><span class="type">int</span> QImageReader::<span class="name">quality</span> () const</h3>
<p>Returns the quality level of the image.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qimagereader.html#setQuality">setQuality</a>().</p>
<!-- @@@quality -->
<!-- $$$read[overload1]$$$read -->
<h3 class="fn"><a name="read"></a><span class="type"><a href="qimage.html">QImage</a></span> QImageReader::<span class="name">read</span> ()</h3>
<p>Reads an image from the device. On success, the image that was read is returned; otherwise, a null <a href="qimage.html">QImage</a> is returned. You can then call <a href="qimagereader.html#error">error</a>() to find the type of error that occurred, or <a href="qimagereader.html#errorString">errorString</a>() to get a human readable description of the error.</p>
<p>For image formats that support animation, calling read() repeatedly will return the next frame. When all frames have been read, a null image will be returned.</p>
<p><b>See also </b><a href="qimagereader.html#canRead">canRead</a>(), <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>(), <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), and <a href="qmovie.html">QMovie</a>.</p>
<!-- @@@read -->
<!-- $$$read$$$readQImage* -->
<h3 class="fn"><a name="read-2"></a><span class="type">bool</span> QImageReader::<span class="name">read</span> ( <span class="type"><a href="qimage.html">QImage</a></span> * <i>image</i> )</h3>
<p>This is an overloaded function.</p>
<p>Reads an image from the device into <i>image</i>, which must point to a <a href="qimage.html">QImage</a>. Returns true on success; otherwise, returns false.</p>
<p>If <i>image</i> has same format and size as the image data that is about to be read, this function may not need to allocate a new image before reading. Because of this, it can be faster than the other <a href="qimagereader.html#read">read</a>() overload, which always constructs a new image; especially when reading several images with the same format and size.</p>
<pre class="cpp"> <span class="type"><a href="qimage.html">QImage</a></span> icon(<span class="number">64</span><span class="operator">,</span> <span class="number">64</span><span class="operator">,</span> <span class="type"><a href="qimage.html">QImage</a></span><span class="operator">::</span>Format_RGB32);
 <span class="type"><a href="qimagereader.html">QImageReader</a></span> reader(<span class="string">&quot;icon_64x64.bmp&quot;</span>);
 <span class="keyword">if</span> (reader<span class="operator">.</span>read(<span class="operator">&amp;</span>icon)) {
     <span class="comment">// Display icon</span>
 }</pre>
<p>For image formats that support animation, calling <a href="qimagereader.html#read">read</a>() repeatedly will return the next frame. When all frames have been read, a null image will be returned.</p>
<p><b>See also </b><a href="qimagereader.html#canRead">canRead</a>(), <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>(), <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), and <a href="qmovie.html">QMovie</a>.</p>
<!-- @@@read -->
<!-- $$$scaledClipRect[overload1]$$$scaledClipRect -->
<h3 class="fn"><a name="scaledClipRect"></a><span class="type"><a href="qrect.html">QRect</a></span> QImageReader::<span class="name">scaledClipRect</span> () const</h3>
<p>Returns the scaled clip rect of the image.</p>
<p><b>See also </b><a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<!-- @@@scaledClipRect -->
<!-- $$$scaledSize[overload1]$$$scaledSize -->
<h3 class="fn"><a name="scaledSize"></a><span class="type"><a href="qsize.html">QSize</a></span> QImageReader::<span class="name">scaledSize</span> () const</h3>
<p>Returns the scaled size of the image.</p>
<p><b>See also </b><a href="qimagereader.html#setScaledSize">setScaledSize</a>().</p>
<!-- @@@scaledSize -->
<!-- $$$setAutoDetectImageFormat[overload1]$$$setAutoDetectImageFormatbool -->
<h3 class="fn"><a name="setAutoDetectImageFormat"></a><span class="type">void</span> QImageReader::<span class="name">setAutoDetectImageFormat</span> ( <span class="type">bool</span> <i>enabled</i> )</h3>
<p>If <i>enabled</i> is true, image format autodetection is enabled; otherwise, it is disabled. By default, autodetection is enabled.</p>
<p><a href="qimagereader.html">QImageReader</a> uses an extensive approach to detecting the image format; firstly, if you pass a file name to <a href="qimagereader.html">QImageReader</a>, it will attempt to detect the file extension if the given file name does not point to an existing file, by appending supported default extensions to the given file name, one at a time. It then uses the following approach to detect the image format:</p>
<ul>
<li>Image plugins are queried first, based on either the optional format string, or the file name suffix (if the source device is a file). No content detection is done at this stage. <a href="qimagereader.html">QImageReader</a> will choose the first plugin that supports reading for this format.</li>
<li>If no plugin supports the image format, Qt's built-in handlers are checked based on either the optional format string, or the file name suffix.</li>
<li>If no capable plugins or built-in handlers are found, each plugin is tested by inspecting the content of the data stream.</li>
<li>If no plugins could detect the image format based on data contents, each built-in image handler is tested by inspecting the contents.</li>
<li>Finally, if all above approaches fail, <a href="qimagereader.html">QImageReader</a> will report failure when trying to read the image.</li>
</ul>
<p>By disabling image format autodetection, <a href="qimagereader.html">QImageReader</a> will only query the plugins and built-in handlers based on the format string (i.e&#x2e;, no file name extensions are tested).</p>
<p><b>See also </b><a href="qimagereader.html#autoDetectImageFormat">autoDetectImageFormat</a>(), <a href="qimageiohandler.html#canRead">QImageIOHandler::canRead</a>(), and <a href="qimageioplugin.html#capabilities">QImageIOPlugin::capabilities</a>().</p>
<!-- @@@setAutoDetectImageFormat -->
<!-- $$$setBackgroundColor[overload1]$$$setBackgroundColorconstQColor& -->
<h3 class="fn"><a name="setBackgroundColor"></a><span class="type">void</span> QImageReader::<span class="name">setBackgroundColor</span> ( const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i> )</h3>
<p>Sets the background color to <i>color</i>. Image formats that support this operation are expected to initialize the background to <i>color</i> before reading an image.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimagereader.html#backgroundColor">backgroundColor</a>() and <a href="qimagereader.html#read">read</a>().</p>
<!-- @@@setBackgroundColor -->
<!-- $$$setClipRect[overload1]$$$setClipRectconstQRect& -->
<h3 class="fn"><a name="setClipRect"></a><span class="type">void</span> QImageReader::<span class="name">setClipRect</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rect</i> )</h3>
<p>Sets the image clip rect (also known as the ROI, or Region Of Interest) to <i>rect</i>. The coordinates of <i>rect</i> are relative to the untransformed image size, as returned by <a href="qimagereader.html#size">size</a>().</p>
<p><b>See also </b><a href="qimagereader.html#clipRect">clipRect</a>(), <a href="qimagereader.html#setScaledSize">setScaledSize</a>(), and <a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<!-- @@@setClipRect -->
<!-- $$$setDecideFormatFromContent[overload1]$$$setDecideFormatFromContentbool -->
<h3 class="fn"><a name="setDecideFormatFromContent"></a><span class="type">void</span> QImageReader::<span class="name">setDecideFormatFromContent</span> ( <span class="type">bool</span> <i>ignored</i> )</h3>
<p>If <i>ignored</i> is set to true, then the image reader will ignore specified formats or file extensions and decide which plugin to use only based on the contents in the datastream.</p>
<p>Setting this flag means that all image plugins gets loaded. Each plugin will read the first bytes in the image data and decide if the plugin is compatible or not.</p>
<p>This also disables auto detecting the image format.</p>
<p><b>See also </b><a href="qimagereader.html#decideFormatFromContent">decideFormatFromContent</a>().</p>
<!-- @@@setDecideFormatFromContent -->
<!-- $$$setDevice[overload1]$$$setDeviceQIODevice* -->
<h3 class="fn"><a name="setDevice"></a><span class="type">void</span> QImageReader::<span class="name">setDevice</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>device</i> )</h3>
<p>Sets <a href="qimagereader.html">QImageReader</a>'s device to <i>device</i>. If a device has already been set, the old device is removed from <a href="qimagereader.html">QImageReader</a> and is otherwise left unchanged.</p>
<p>If the device is not already open, <a href="qimagereader.html">QImageReader</a> will attempt to open the device in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::ReadOnly</a> mode by calling open(). Note that this does not work for certain devices, such as <a href="qprocess.html">QProcess</a>, <a href="qtcpsocket.html">QTcpSocket</a> and <a href="qudpsocket.html">QUdpSocket</a>, where more logic is required to open the device.</p>
<p><b>See also </b><a href="qimagereader.html#device">device</a>() and <a href="qimagereader.html#setFileName">setFileName</a>().</p>
<!-- @@@setDevice -->
<!-- $$$setFileName[overload1]$$$setFileNameconstQString& -->
<h3 class="fn"><a name="setFileName"></a><span class="type">void</span> QImageReader::<span class="name">setFileName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i> )</h3>
<p>Sets the file name of <a href="qimagereader.html">QImageReader</a> to <i>fileName</i>. Internally, <a href="qimagereader.html">QImageReader</a> will create a <a href="qfile.html">QFile</a> object and open it in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::ReadOnly</a> mode, and use this when reading images.</p>
<p>If <i>fileName</i> does not include a file extension (e.g&#x2e;, .png or .bmp), <a href="qimagereader.html">QImageReader</a> will cycle through all supported extensions until it finds a matching file.</p>
<p><b>See also </b><a href="qimagereader.html#fileName">fileName</a>(), <a href="qimagereader.html#setDevice">setDevice</a>(), and <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>().</p>
<!-- @@@setFileName -->
<!-- $$$setFormat[overload1]$$$setFormatconstQByteArray& -->
<h3 class="fn"><a name="setFormat"></a><span class="type">void</span> QImageReader::<span class="name">setFormat</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>format</i> )</h3>
<p>Sets the format <a href="qimagereader.html">QImageReader</a> will use when reading images, to <i>format</i>. <i>format</i> is a case insensitive text string. Example:</p>
<pre class="cpp"> <span class="type"><a href="qimagereader.html">QImageReader</a></span> reader;
 reader<span class="operator">.</span>setFormat(<span class="string">&quot;png&quot;</span>); <span class="comment">// same as reader.setFormat(&quot;PNG&quot;);</span></pre>
<p>You can call <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>() for the full list of formats <a href="qimagereader.html">QImageReader</a> supports.</p>
<p><b>See also </b><a href="qimagereader.html#format">format</a>().</p>
<!-- @@@setFormat -->
<!-- $$$setQuality[overload1]$$$setQualityint -->
<h3 class="fn"><a name="setQuality"></a><span class="type">void</span> QImageReader::<span class="name">setQuality</span> ( <span class="type">int</span> <i>quality</i> )</h3>
<p>This is an image format specific function that sets the quality level of the image to <i>quality</i>. For image formats that do not support setting the quality, this value is ignored.</p>
<p>The value range of <i>quality</i> depends on the image format. For example, the &quot;jpeg&quot; format supports a quality range from 0 (low quality, high compression) to 100 (high quality, low compression).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qimagereader.html#quality">quality</a>().</p>
<!-- @@@setQuality -->
<!-- $$$setScaledClipRect[overload1]$$$setScaledClipRectconstQRect& -->
<h3 class="fn"><a name="setScaledClipRect"></a><span class="type">void</span> QImageReader::<span class="name">setScaledClipRect</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rect</i> )</h3>
<p>Sets the scaled clip rect to <i>rect</i>. The scaled clip rect is the clip rect (also known as ROI, or Region Of Interest) that is applied after the image has been scaled.</p>
<p><b>See also </b><a href="qimagereader.html#scaledClipRect">scaledClipRect</a>() and <a href="qimagereader.html#setScaledSize">setScaledSize</a>().</p>
<!-- @@@setScaledClipRect -->
<!-- $$$setScaledSize[overload1]$$$setScaledSizeconstQSize& -->
<h3 class="fn"><a name="setScaledSize"></a><span class="type">void</span> QImageReader::<span class="name">setScaledSize</span> ( const <span class="type"><a href="qsize.html">QSize</a></span> &amp; <i>size</i> )</h3>
<p>Sets the scaled size of the image to <i>size</i>. The scaling is performed after the initial clip rect, but before the scaled clip rect is applied. The algorithm used for scaling depends on the image format. By default (i.e&#x2e;, if the image format does not support scaling), <a href="qimagereader.html">QImageReader</a> will use QImage::scale() with Qt::SmoothScaling.</p>
<p><b>See also </b><a href="qimagereader.html#scaledSize">scaledSize</a>(), <a href="qimagereader.html#setClipRect">setClipRect</a>(), and <a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<!-- @@@setScaledSize -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type"><a href="qsize.html">QSize</a></span> QImageReader::<span class="name">size</span> () const</h3>
<p>Returns the size of the image, without actually reading the image contents.</p>
<p>If the image format does not support this feature, this function returns an invalid size. Qt's built-in image handlers all support this feature, but custom image format plugins are not required to do so.</p>
<p><b>See also </b><a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::ImageOption</a>, <a href="qimageiohandler.html#option">QImageIOHandler::option</a>(), and <a href="qimageiohandler.html#supportsOption">QImageIOHandler::supportsOption</a>().</p>
<!-- @@@size -->
<!-- $$$supportedImageFormats[overload1]$$$supportedImageFormats -->
<h3 class="fn"><a name="supportedImageFormats"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qbytearray.html">QByteArray</a></span>&gt; QImageReader::<span class="name">supportedImageFormats</span> ()<tt> [static]</tt></h3>
<p>Returns the list of image formats supported by <a href="qimagereader.html">QImageReader</a>.</p>
<p>By default, Qt can read the following formats:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Format</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >BMP</td><td >Windows Bitmap</td></tr>
<tr valign="top" class="even"><td >GIF</td><td >Graphic Interchange Format (optional)</td></tr>
<tr valign="top" class="odd"><td >JPG</td><td >Joint Photographic Experts Group</td></tr>
<tr valign="top" class="even"><td >JPEG</td><td >Joint Photographic Experts Group</td></tr>
<tr valign="top" class="odd"><td >MNG</td><td >Multiple-image Network Graphics</td></tr>
<tr valign="top" class="even"><td >PNG</td><td >Portable Network Graphics</td></tr>
<tr valign="top" class="odd"><td >PBM</td><td >Portable Bitmap</td></tr>
<tr valign="top" class="even"><td >PGM</td><td >Portable Graymap</td></tr>
<tr valign="top" class="odd"><td >PPM</td><td >Portable Pixmap</td></tr>
<tr valign="top" class="even"><td >TIFF</td><td >Tagged Image File Format</td></tr>
<tr valign="top" class="odd"><td >XBM</td><td >X11 Bitmap</td></tr>
<tr valign="top" class="even"><td >XPM</td><td >X11 Pixmap</td></tr>
<tr valign="top" class="odd"><td >SVG</td><td >Scalable Vector Graphics</td></tr>
<tr valign="top" class="even"><td >TGA</td><td >Targa Image Format</td></tr>
</table>
<p>Reading and writing SVG files is supported through Qt's <a href="qtsvg.html">SVG Module</a>.</p>
<p>TGA support only extends to reading non-RLE compressed files. In particular calls to <a href="http://doc.qt.nokia.com/4.7-snapshot/qimageioplugin.html#capabilities">capabilities</a> for the tga plugin returns only <a href="qimageioplugin.html#Capability-enum">QImageIOPlugin::CanRead</a>, not <a href="qimageioplugin.html#Capability-enum">QImageIOPlugin::CanWrite</a>.</p>
<p>To configure Qt with GIF support, pass <tt>-qt-gif</tt> to the <tt>configure</tt> script or check the appropriate option in the graphical installer.</p>
<p>Note that the <a href="qapplication.html">QApplication</a> instance must be created before this function is called.</p>
<p><b>See also </b><a href="qimagereader.html#setFormat">setFormat</a>(), <a href="qimagewriter.html#supportedImageFormats">QImageWriter::supportedImageFormats</a>(), and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<!-- @@@supportedImageFormats -->
<!-- $$$supportsAnimation[overload1]$$$supportsAnimation -->
<h3 class="fn"><a name="supportsAnimation"></a><span class="type">bool</span> QImageReader::<span class="name">supportsAnimation</span> () const</h3>
<p>Returns true if the image format supports animation; otherwise, false is returned.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qmovie.html#supportedFormats">QMovie::supportedFormats</a>().</p>
<!-- @@@supportsAnimation -->
<!-- $$$supportsOption[overload1]$$$supportsOptionQImageIOHandler::ImageOption -->
<h3 class="fn"><a name="supportsOption"></a><span class="type">bool</span> QImageReader::<span class="name">supportsOption</span> ( <span class="type"><a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::ImageOption</a></span> <i>option</i> ) const</h3>
<p>Returns true if the reader supports <i>option</i>; otherwise returns false.</p>
<p>Different image formats support different options. Call this function to determine whether a certain option is supported by the current format. For example, the PNG format allows you to embed text into the image's metadata (see <a href="qimagereader.html#text">text</a>()), and the BMP format allows you to determine the image's size without loading the whole image into memory (see <a href="qimagereader.html#size">size</a>()).</p>
<pre class="cpp"> <span class="type"><a href="qimagereader.html">QImageReader</a></span> reader(<span class="string">&quot;:/image.png&quot;</span>);
 <span class="keyword">if</span> (reader<span class="operator">.</span>supportsOption(<span class="type"><a href="qimageiohandler.html">QImageIOHandler</a></span><span class="operator">::</span>Size))
     <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Size:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> reader<span class="operator">.</span><a href="qimagereader.html#size">size</a>();</pre>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qimagewriter.html#supportsOption">QImageWriter::supportsOption</a>().</p>
<!-- @@@supportsOption -->
<!-- $$$text[overload1]$$$textconstQString& -->
<h3 class="fn"><a name="text"></a><span class="type"><a href="qstring.html">QString</a></span> QImageReader::<span class="name">text</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> ) const</h3>
<p>Returns the image text associated with <i>key</i>.</p>
<p>Support for this option is implemented through <a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::Description</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimagereader.html#textKeys">textKeys</a>() and <a href="qimagewriter.html#setText">QImageWriter::setText</a>().</p>
<!-- @@@text -->
<!-- $$$textKeys[overload1]$$$textKeys -->
<h3 class="fn"><a name="textKeys"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QImageReader::<span class="name">textKeys</span> () const</h3>
<p>Returns the text keys for this image. You can use these keys with <a href="qimagereader.html#text">text</a>() to list the image text for a certain key.</p>
<p>Support for this option is implemented through <a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler::Description</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimagereader.html#text">text</a>(), <a href="qimagewriter.html#setText">QImageWriter::setText</a>(), and <a href="qimage.html#textKeys">QImage::textKeys</a>().</p>
<!-- @@@textKeys -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      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.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>