1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
<?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>QSize 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="../pyqt4ref.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">QSize Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QSize class defines the size of a two-dimensional object using integer point precision. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsize.html#QSize">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsize.html#QSize-2">__init__</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qsize.html#QSize-3">__init__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />QSize <b><a href="qsize.html#boundedTo">boundedTo</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />QSize <b><a href="qsize.html#expandedTo">expandedTo</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />int <b><a href="qsize.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsize.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsize.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsize.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsize.html#scale">scale</a></b> (<i>self</i>, QSize, Qt.AspectRatioMode)</li><li><div class="fn" /><b><a href="qsize.html#scale-2">scale</a></b> (<i>self</i>, int, int, Qt.AspectRatioMode)</li><li><div class="fn" /><b><a href="qsize.html#setHeight">setHeight</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qsize.html#setWidth">setWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qsize.html#transpose">transpose</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsize.html#width">width</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QSize <b><a href="qsize.html#__add__">__add__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />int <b><a href="qsize.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__div__">__div__</a></b> (<i>self</i>, float)</li><li><div class="fn" />bool <b><a href="qsize.html#__eq__">__eq__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />QSize <b><a href="qsize.html#__iadd__">__iadd__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />QSize <b><a href="qsize.html#__idiv__">__idiv__</a></b> (<i>self</i>, float)</li><li><div class="fn" />QSize <b><a href="qsize.html#__imul__">__imul__</a></b> (<i>self</i>, float)</li><li><div class="fn" />QSize <b><a href="qsize.html#__isub__">__isub__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />QSize <b><a href="qsize.html#__mul__">__mul__</a></b> (<i>self</i>, float)</li><li><div class="fn" />QSize <b><a href="qsize.html#__mul__-2">__mul__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />bool <b><a href="qsize.html#__ne__">__ne__</a></b> (<i>self</i>, QSize)</li><li><div class="fn" />str <b><a href="qsize.html#__repr__">__repr__</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__sub__">__sub__</a></b> (<i>self</i>, QSize)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QSize class defines the size of a two-dimensional object using integer point precision.</p>
<p>A size is specified by a <a href="qsize.html#width">width</a>() and a <a href="qsize.html#height">height</a>(). It can be set in the constructor and changed using the <a href="qsize.html#setWidth">setWidth</a>(), <a href="qsize.html#setHeight">setHeight</a>(), or <a href="qsize.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="qsize.html#rwidth">rwidth</a>() and <a href="qsize.html#rheight">rheight</a>() functions. Finally, the width and height can be swapped using the <a href="qsize.html#transpose">transpose</a>() function.</p>
<p>The <a href="qsize.html#isValid">isValid</a>() function determines if a size is valid (a valid size has both width and height greater than zero). The <a href="qsize.html#isEmpty">isEmpty</a>() function returns true if either of the width and height is less than, or equal to, zero, while the <a href="qsize.html#isNull">isNull</a>() function returns true only if both the width and the height is zero.</p>
<p>Use the <a href="qsize.html#expandedTo">expandedTo</a>() function to retrieve a size which holds the maximum height and width of <i>this</i> size and a given size. Similarly, the <a href="qsize.html#boundedTo">boundedTo</a>() function returns a size which holds the minimum height and width of <i>this</i> size and a given size.</p>
<p>QSize objects can be streamed as well as compared.</p>
<p>See also <a href="qsizef.html">QSizeF</a>, <a href="qpoint.html">QPoint</a>, and <a href="qrect.html">QRect</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSize" />QSize.__init__ (<i>self</i>)</h3><p>Constructs a size with an invalid width and height (i.e., <a href="qsize.html#isValid">isValid</a>() returns false).</p>
<p>See also <a href="qsize.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QSize-2" />QSize.__init__ (<i>self</i>, int, int)</h3><p>Constructs a size with the given <i>width</i> and <i>height</i>.</p>
<p>See also <a href="qsize.html#setWidth">setWidth</a>() and <a href="qsize.html#setHeight">setHeight</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/boundedTo" />
<h3 class="fn"><a name="QSize-3" />QSize.__init__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="boundedTo" /><a href="qsize.html">QSize</a> QSize.boundedTo (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><p>Returns a size holding the minimum width and height of this size and the given <i>otherSize</i>.</p>
<p>See also <a href="qsize.html#expandedTo">expandedTo</a>() and <a href="qsize.html#scale">scale</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/expandedTo" />
<h3 class="fn"><a name="expandedTo" /><a href="qsize.html">QSize</a> QSize.expandedTo (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><p>Returns a size holding the maximum width and height of this size and the given <i>otherSize</i>.</p>
<p>See also <a href="qsize.html#boundedTo">boundedTo</a>() and <a href="qsize.html#scale">scale</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/height" />
<h3 class="fn"><a name="height" />int QSize.height (<i>self</i>)</h3><p>Returns the height.</p>
<p>See also <a href="qsize.html#width">width</a>() and <a href="qsize.html#setHeight">setHeight</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/isEmpty" />
<h3 class="fn"><a name="isEmpty" />bool QSize.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>See also <a href="qsize.html#isNull">isNull</a>() and <a href="qsize.html#isValid">isValid</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/isNull" />
<h3 class="fn"><a name="isNull" />bool QSize.isNull (<i>self</i>)</h3><p>Returns true if both the width and height is 0; otherwise returns false.</p>
<p>See also <a href="qsize.html#isValid">isValid</a>() and <a href="qsize.html#isEmpty">isEmpty</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/isValid" />
<h3 class="fn"><a name="isValid" />bool QSize.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>See also <a href="qsize.html#isNull">isNull</a>() and <a href="qsize.html#isEmpty">isEmpty</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/rheight" />
<h3 class="fn"><a name="scale" />QSize.scale (<i>self</i>, <a href="qsize.html">QSize</a>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>)</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> QSize t1(10, 12);
t1.scale(60, 60, Qt.IgnoreAspectRatio);
<span class="comment"> // t1 is (60, 60)</span>
QSize t2(10, 12);
t2.scale(60, 60, Qt.KeepAspectRatio);
<span class="comment"> // t2 is (50, 60)</span>
QSize t3(10, 12);
t3.scale(60, 60, Qt.KeepAspectRatioByExpanding);
<span class="comment"> // t3 is (60, 72)</span></pre>
<p>See also <a href="qsize.html#setWidth">setWidth</a>() and <a href="qsize.html#setHeight">setHeight</a>().</p>
<h3 class="fn"><a name="scale-2" />QSize.scale (<i>self</i>, int, int, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>)</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>
<a name="//apple_ref/cpp/instm/QSize/setHeight" />
<h3 class="fn"><a name="setHeight" />QSize.setHeight (<i>self</i>, int)</h3><p>Sets the height to the given <i>height</i>.</p>
<p>See also <a href="qsize.html#rheight">rheight</a>(), <a href="qsize.html#height">height</a>(), and <a href="qsize.html#setWidth">setWidth</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/setWidth" />
<h3 class="fn"><a name="setWidth" />QSize.setWidth (<i>self</i>, int)</h3><p>Sets the width to the given <i>width</i>.</p>
<p>See also <a href="qsize.html#rwidth">rwidth</a>(), <a href="qsize.html#width">width</a>(), and <a href="qsize.html#setHeight">setHeight</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/transpose" />
<h3 class="fn"><a name="transpose" />QSize.transpose (<i>self</i>)</h3><p>Swaps the width and height values.</p>
<p>See also <a href="qsize.html#setWidth">setWidth</a>() and <a href="qsize.html#setHeight">setHeight</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/width" />
<h3 class="fn"><a name="width" />int QSize.width (<i>self</i>)</h3><p>Returns the width.</p>
<p>See also <a href="qsize.html#height">height</a>() and <a href="qsize.html#setWidth">setWidth</a>().</p>
<a name="//apple_ref/cpp/instm/QSize/operator*=" />
<h3 class="fn"><a name="__add__" /><a href="qsize.html">QSize</a> QSize.__add__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__bool__" />int QSize.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__div__" /><a href="qsize.html">QSize</a> QSize.__div__ (<i>self</i>, float)</h3><h3 class="fn"><a name="__eq__" />bool QSize.__eq__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qsize.html">QSize</a> QSize.__iadd__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__idiv__" /><a href="qsize.html">QSize</a> QSize.__idiv__ (<i>self</i>, float)</h3><h3 class="fn"><a name="__imul__" /><a href="qsize.html">QSize</a> QSize.__imul__ (<i>self</i>, float)</h3><h3 class="fn"><a name="__isub__" /><a href="qsize.html">QSize</a> QSize.__isub__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__mul__" /><a href="qsize.html">QSize</a> QSize.__mul__ (<i>self</i>, float)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qsize.html">QSize</a> QSize.__mul__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__ne__" />bool QSize.__ne__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="__repr__" />str QSize.__repr__ (<i>self</i>)</h3><h3 class="fn"><a name="__sub__" /><a href="qsize.html">QSize</a> QSize.__sub__ (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.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> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|