File: qsize.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (134 lines) | stat: -rw-r--r-- 14,441 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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&#160;<i>w</i>, int&#160;<i>h</i>)</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&#160;<i>otherSize</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#expandedTo">expandedTo</a></b> (<i>self</i>, QSize&#160;<i>otherSize</i>)</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&#160;<i>s</i>, Qt.AspectRatioMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qsize.html#scale-2">scale</a></b> (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, Qt.AspectRatioMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qsize.html#setHeight">setHeight</a></b> (<i>self</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qsize.html#setWidth">setWidth</a></b> (<i>self</i>, int&#160;<i>w</i>)</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&#160;<i>s2</i>)</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&#160;<i>c</i>)</li><li><div class="fn" />bool <b><a href="qsize.html#__eq__">__eq__</a></b> (<i>self</i>, QSize&#160;<i>s2</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__iadd__">__iadd__</a></b> (<i>self</i>, QSize&#160;<i>s</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__idiv__">__idiv__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__imul__">__imul__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__isub__">__isub__</a></b> (<i>self</i>, QSize&#160;<i>s</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__mul__">__mul__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />QSize <b><a href="qsize.html#__mul__-2">__mul__</a></b> (<i>self</i>, QSize&#160;<i>s</i>)</li><li><div class="fn" />bool <b><a href="qsize.html#__ne__">__ne__</a></b> (<i>self</i>, QSize&#160;<i>s2</i>)</li><li><div class="fn" />object <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&#160;<i>s2</i>)</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>
<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><b>See also</b> <a href="qsize.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="QSize-2" />QSize.__init__ (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>Constructs a size with the given <i>width</i> and
<i>height</i>.</p>
<p><b>See also</b> <a href="qsize.html#setWidth">setWidth</a>() and
<a href="qsize.html#setHeight">setHeight</a>().</p>


<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>&#160;<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="qsize.html#expandedTo">expandedTo</a>()
and <a href="qsize.html#scale">scale</a>().</p>


<h3 class="fn"><a name="expandedTo" /><a href="qsize.html">QSize</a> QSize.expandedTo (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<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="qsize.html#boundedTo">boundedTo</a>()
and <a href="qsize.html#scale">scale</a>().</p>


<h3 class="fn"><a name="height" />int QSize.height (<i>self</i>)</h3><p>Returns the height.</p>
<p><b>See also</b> <a href="qsize.html#width">width</a>() and
<a href="qsize.html#setHeight">setHeight</a>().</p>


<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><b>See also</b> <a href="qsize.html#isNull">isNull</a>() and
<a href="qsize.html#isValid">isValid</a>().</p>


<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><b>See also</b> <a href="qsize.html#isValid">isValid</a>() and
<a href="qsize.html#isEmpty">isEmpty</a>().</p>


<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><b>See also</b> <a href="qsize.html#isNull">isNull</a>() and
<a href="qsize.html#isEmpty">isEmpty</a>().</p>


<h3 class="fn"><a name="scale" />QSize.scale (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>&#160;<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="qsize.html">QSize</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="qsize.html">QSize</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="qsize.html">QSize</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="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&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qt.html#AspectRatioMode-enum">Qt.AspectRatioMode</a>&#160;<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" />QSize.setHeight (<i>self</i>, int&#160;<i>h</i>)</h3><p>Sets the height to the given <i>height</i>.</p>
<p><b>See also</b> <a href="qsize.html#rheight">rheight</a>(),
<a href="qsize.html#height">height</a>(), and <a href="qsize.html#setWidth">setWidth</a>().</p>


<h3 class="fn"><a name="setWidth" />QSize.setWidth (<i>self</i>, int&#160;<i>w</i>)</h3><p>Sets the width to the given <i>width</i>.</p>
<p><b>See also</b> <a href="qsize.html#rwidth">rwidth</a>(),
<a href="qsize.html#width">width</a>(), and <a href="qsize.html#setHeight">setHeight</a>().</p>


<h3 class="fn"><a name="transpose" />QSize.transpose (<i>self</i>)</h3><p>Swaps the width and height values.</p>
<p><b>See also</b> <a href="qsize.html#setWidth">setWidth</a>() and
<a href="qsize.html#setHeight">setHeight</a>().</p>


<h3 class="fn"><a name="width" />int QSize.width (<i>self</i>)</h3><p>Returns the width.</p>
<p><b>See also</b> <a href="qsize.html#height">height</a>() and
<a href="qsize.html#setWidth">setWidth</a>().</p>


<h3 class="fn"><a name="__add__" /><a href="qsize.html">QSize</a> QSize.__add__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s2</i>)</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&#160;<i>c</i>)</h3><h3 class="fn"><a name="__eq__" />bool QSize.__eq__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s2</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qsize.html">QSize</a> QSize.__iadd__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s</i>)</h3><h3 class="fn"><a name="__idiv__" /><a href="qsize.html">QSize</a> QSize.__idiv__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__imul__" /><a href="qsize.html">QSize</a> QSize.__imul__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qsize.html">QSize</a> QSize.__isub__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qsize.html">QSize</a> QSize.__mul__ (<i>self</i>, float&#160;<i>c</i>)</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>&#160;<i>s</i>)</h3><h3 class="fn"><a name="__ne__" />bool QSize.__ne__ (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>s2</i>)</h3><h3 class="fn"><a name="__repr__" />object 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>&#160;<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&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>