<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QSizeF Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSizeF Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QSizeF class defines the size of a two-dimensional object using floating point precision. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsizef.html#QSizeF">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsizef.html#QSizeF-2">__init__</a></b> (<i>self</i>, QSize <i>sz</i>)</li><li><div class="fn" /><b><a href="qsizef.html#QSizeF-3">__init__</a></b> (<i>self</i>, float <i>w</i>, float <i>h</i>)</li><li><div class="fn" /><b><a href="qsizef.html#QSizeF-4">__init__</a></b> (<i>self</i>, QSizeF)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#boundedTo">boundedTo</a></b> (<i>self</i>, QSizeF <i>otherSize</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#expandedTo">expandedTo</a></b> (<i>self</i>, QSizeF <i>otherSize</i>)</li><li><div class="fn" />float <b><a href="qsizef.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsizef.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsizef.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsizef.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsizef.html#scale">scale</a></b> (<i>self</i>, QSizeF <i>s</i>, Qt.AspectRatioMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qsizef.html#scale-2">scale</a></b> (<i>self</i>, float <i>w</i>, float <i>h</i>, Qt.AspectRatioMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qsizef.html#setHeight">setHeight</a></b> (<i>self</i>, float <i>h</i>)</li><li><div class="fn" /><b><a href="qsizef.html#setWidth">setWidth</a></b> (<i>self</i>, float <i>w</i>)</li><li><div class="fn" />QSize <b><a href="qsizef.html#toSize">toSize</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsizef.html#transpose">transpose</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qsizef.html#width">width</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QSizeF <b><a href="qsizef.html#__add__">__add__</a></b> (<i>self</i>, QSizeF <i>s2</i>)</li><li><div class="fn" />int <b><a href="qsizef.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__div__">__div__</a></b> (<i>self</i>, float <i>c</i>)</li><li><div class="fn" />bool <b><a href="qsizef.html#__eq__">__eq__</a></b> (<i>self</i>, QSizeF <i>s2</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__iadd__">__iadd__</a></b> (<i>self</i>, QSizeF <i>s</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__idiv__">__idiv__</a></b> (<i>self</i>, float <i>c</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__imul__">__imul__</a></b> (<i>self</i>, float <i>c</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__isub__">__isub__</a></b> (<i>self</i>, QSizeF <i>s</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__mul__">__mul__</a></b> (<i>self</i>, float <i>c</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__mul__-2">__mul__</a></b> (<i>self</i>, QSizeF <i>s</i>)</li><li><div class="fn" />bool <b><a href="qsizef.html#__ne__">__ne__</a></b> (<i>self</i>, QSizeF <i>s2</i>)</li><li><div class="fn" />str <b><a href="qsizef.html#__repr__">__repr__</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qsizef.html#__sub__">__sub__</a></b> (<i>self</i>, QSizeF <i>s2</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QSizeF class defines the size of a two-dimensional object using floating point precision.</p> <p>A size is specified by a <a href="qsizef.html#width">width</a>() and a <a href="qsizef.html#height">height</a>(). It can be set in the constructor and changed using the <a href="qsizef.html#setWidth">setWidth</a>(), <a href="qsizef.html#setHeight">setHeight</a>(), or <a href="qsizef.html#scale">scale</a>() functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the <a href="qsizef.html#rwidth">rwidth</a>() and <a href="qsizef.html#rheight">rheight</a>() functions. Finally, the width and height can be swapped using the <a href="qsizef.html#transpose">transpose</a>() function.</p> <p>The <a href="qsizef.html#isValid">isValid</a>() function determines if a size is valid. A valid size has both width and height greater than or equal to zero. The <a href="qsizef.html#isEmpty">isEmpty</a>() function returns true if either of the width and height is <i>less</i> than (or equal to) zero, while the <a href="qsizef.html#isNull">isNull</a>() function returns true only if both the width and the height is zero.</p> <p>Use the <a href="qsizef.html#expandedTo">expandedTo</a>() function to retrieve a size which holds the maximum height and width of this size and a given size. Similarly, the <a href="qsizef.html#boundedTo">boundedTo</a>() function returns a size which holds the minimum height and width of this size and a given size.</p> <p>The QSizeF class also provides the <a href="qsizef.html#toSize">toSize</a>() function returning a <a href="qsize.html">QSize</a> copy of this size, constructed by rounding the width and height to the nearest integers.</p> <p>QSizeF objects can be streamed as well as compared.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSizeF" />QSizeF.__init__ (<i>self</i>)</h3><p>Constructs an invalid size.</p> <p><b>See also</b> <a href="qsizef.html#isValid">isValid</a>().</p> <h3 class="fn"><a name="QSizeF-2" />QSizeF.__init__ (<i>self</i>, <a href="qsize.html">QSize</a> <i>sz</i>)</h3><p>Constructs a size with floating point accuracy from the given <i>size</i>.</p> <p><b>See also</b> <a href="qsizef.html#toSize">toSize</a>().</p> <h3 class="fn"><a name="QSizeF-3" />QSizeF.__init__ (<i>self</i>, float <i>w</i>, float <i>h</i>)</h3><p>Constructs a size with the given <i>width</i> and <i>height</i>.</p> <h3 class="fn"><a name="QSizeF-4" />QSizeF.__init__ (<i>self</i>, <a href="qsizef.html">QSizeF</a>)</h3><h3 class="fn"><a name="boundedTo" /><a href="qsizef.html">QSizeF</a> QSizeF.boundedTo (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>otherSize</i>)</h3><p>Returns a size holding the minimum width and height of this size and the given <i>otherSize</i>.</p> <p><b>See also</b> <a href="qsizef.html#expandedTo">expandedTo</a>() and <a href="qsizef.html#scale">scale</a>().</p> <h3 class="fn"><a name="expandedTo" /><a href="qsizef.html">QSizeF</a> QSizeF.expandedTo (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>otherSize</i>)</h3><p>Returns a size holding the maximum width and height of this size and the given <i>otherSize</i>.</p> <p><b>See also</b> <a href="qsizef.html#boundedTo">boundedTo</a>() and <a href="qsizef.html#scale">scale</a>().</p> <h3 class="fn"><a name="height" />float QSizeF.height (<i>self</i>)</h3><p>Returns the height.</p> <p><b>See also</b> <a href="qsizef.html#width">width</a>() and <a href="qsizef.html#setHeight">setHeight</a>().</p> <h3 class="fn"><a name="isEmpty" />bool QSizeF.isEmpty (<i>self</i>)</h3><p>Returns true if either of the width and height is less than or equal to 0; otherwise returns false.</p> <p><b>See also</b> <a href="qsizef.html#isNull">isNull</a>() and <a href="qsizef.html#isValid">isValid</a>().</p> <h3 class="fn"><a name="isNull" />bool QSizeF.isNull (<i>self</i>)</h3><p>Returns true if both the width and height are +0.0; otherwise returns false.</p> <p><b>Note:</b> Since this function treats +0.0 and -0.0 differently, sizes with zero width and height where either or both values have a negative sign are not defined to be null sizes.</p> <p><b>See also</b> <a href="qsizef.html#isValid">isValid</a>() and <a href="qsizef.html#isEmpty">isEmpty</a>().</p> <h3 class="fn"><a name="isValid" />bool QSizeF.isValid (<i>self</i>)</h3><p>Returns true if both the width and height is equal to or greater than 0; otherwise returns false.</p> <p><b>See also</b> <a href="qsizef.html#isNull">isNull</a>() and <a href="qsizef.html#isEmpty">isEmpty</a>().</p> <h3 class="fn"><a name="scale" />QSizeF.scale (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a> <i>mode</i>)</h3><p>Scales the size to a rectangle with the given <i>width</i> and <i>height</i>, according to the specified <i>mode</i>.</p> <ul> <li>If <i>mode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.IgnoreAspectRatio</a>, the size is set to (<i>width</i>, <i>height</i>).</li> <li>If <i>mode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.KeepAspectRatio</a>, the current size is scaled to a rectangle as large as possible inside (<i>width</i>, <i>height</i>), preserving the aspect ratio.</li> <li>If <i>mode</i> is <a href="qt.html#AspectRatioMode-enum">Qt.KeepAspectRatioByExpanding</a>, the current size is scaled to a rectangle as small as possible outside (<i>width</i>, <i>height</i>), preserving the aspect ratio.</li> </ul> <p>Example:</p> <pre class="cpp"> <span class="type"><a href="qsizef.html">QSizeF</a></span> t1(<span class="number">10</span><span class="operator">,</span> <span class="number">12</span>); t1<span class="operator">.</span>scale(<span class="number">60</span><span class="operator">,</span> <span class="number">60</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>IgnoreAspectRatio); <span class="comment">// t1 is (60, 60)</span> <span class="type"><a href="qsizef.html">QSizeF</a></span> t2(<span class="number">10</span><span class="operator">,</span> <span class="number">12</span>); t2<span class="operator">.</span>scale(<span class="number">60</span><span class="operator">,</span> <span class="number">60</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>KeepAspectRatio); <span class="comment">// t2 is (50, 60)</span> <span class="type"><a href="qsizef.html">QSizeF</a></span> t3(<span class="number">10</span><span class="operator">,</span> <span class="number">12</span>); t3<span class="operator">.</span>scale(<span class="number">60</span><span class="operator">,</span> <span class="number">60</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>KeepAspectRatioByExpanding); <span class="comment">// t3 is (60, 72)</span> </pre> <p><b>See also</b> <a href="qsizef.html#setWidth">setWidth</a>() and <a href="qsizef.html#setHeight">setHeight</a>().</p> <h3 class="fn"><a name="scale-2" />QSizeF.scale (<i>self</i>, float <i>w</i>, float <i>h</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a> <i>mode</i>)</h3><p>This is an overloaded function.</p> <p>Scales the size to a rectangle with the given <i>size</i>, according to the specified <i>mode</i>.</p> <h3 class="fn"><a name="setHeight" />QSizeF.setHeight (<i>self</i>, float <i>h</i>)</h3><p>Sets the height to the given <i>height</i>.</p> <p><b>See also</b> <a href="qsizef.html#height">height</a>(), <a href="qsizef.html#rheight">rheight</a>(), and <a href="qsizef.html#setWidth">setWidth</a>().</p> <h3 class="fn"><a name="setWidth" />QSizeF.setWidth (<i>self</i>, float <i>w</i>)</h3><p>Sets the width to the given <i>width</i>.</p> <p><b>See also</b> <a href="qsizef.html#width">width</a>(), <a href="qsizef.html#rwidth">rwidth</a>(), and <a href="qsizef.html#setHeight">setHeight</a>().</p> <h3 class="fn"><a name="toSize" /><a href="qsize.html">QSize</a> QSizeF.toSize (<i>self</i>)</h3><p>Returns an integer based copy of this size.</p> <p>Note that the coordinates in the returned size will be rounded to the nearest integer.</p> <p><b>See also</b> <a href="qsizef.html#QSizeF">QSizeF</a>().</p> <h3 class="fn"><a name="transpose" />QSizeF.transpose (<i>self</i>)</h3><p>Swaps the width and height values.</p> <p><b>See also</b> <a href="qsizef.html#setWidth">setWidth</a>() and <a href="qsizef.html#setHeight">setHeight</a>().</p> <h3 class="fn"><a name="width" />float QSizeF.width (<i>self</i>)</h3><p>Returns the width.</p> <p><b>See also</b> <a href="qsizef.html#height">height</a>() and <a href="qsizef.html#setWidth">setWidth</a>().</p> <h3 class="fn"><a name="__add__" /><a href="qsizef.html">QSizeF</a> QSizeF.__add__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s2</i>)</h3><h3 class="fn"><a name="__bool__" />int QSizeF.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__div__" /><a href="qsizef.html">QSizeF</a> QSizeF.__div__ (<i>self</i>, float <i>c</i>)</h3><h3 class="fn"><a name="__eq__" />bool QSizeF.__eq__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s2</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qsizef.html">QSizeF</a> QSizeF.__iadd__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s</i>)</h3><h3 class="fn"><a name="__idiv__" /><a href="qsizef.html">QSizeF</a> QSizeF.__idiv__ (<i>self</i>, float <i>c</i>)</h3><h3 class="fn"><a name="__imul__" /><a href="qsizef.html">QSizeF</a> QSizeF.__imul__ (<i>self</i>, float <i>c</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qsizef.html">QSizeF</a> QSizeF.__isub__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qsizef.html">QSizeF</a> QSizeF.__mul__ (<i>self</i>, float <i>c</i>)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qsizef.html">QSizeF</a> QSizeF.__mul__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s</i>)</h3><h3 class="fn"><a name="__ne__" />bool QSizeF.__ne__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s2</i>)</h3><h3 class="fn"><a name="__repr__" />str QSizeF.__repr__ (<i>self</i>)</h3><h3 class="fn"><a name="__sub__" /><a href="qsizef.html">QSizeF</a> QSizeF.__sub__ (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>s2</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>