summaryrefslogtreecommitdiffstats
path: root/doc/html/qdesktopwidget.html
blob: 738074393a054990ce319d6cda4336eb1318637e (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qdesktopwidget_win.cpp:226 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QDesktopWidget Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDesktopWidget Class Reference</h1>

<p>The QDesktopWidget class provides access to screen information on multi-head systems.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qdesktopwidget-h.html">qdesktopwidget.h</a>&gt;</tt>
<p>Inherits <a href="qwidget.html">QWidget</a>.
<p><a href="qdesktopwidget-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QDesktopWidget"><b>QDesktopWidget</b></a> ()</li>
<li class=fn><a href="#~QDesktopWidget"><b>~QDesktopWidget</b></a> ()</li>
<li class=fn>bool <a href="#isVirtualDesktop"><b>isVirtualDesktop</b></a> () const</li>
<li class=fn>int <a href="#numScreens"><b>numScreens</b></a> () const</li>
<li class=fn>int <a href="#primaryScreen"><b>primaryScreen</b></a> () const</li>
<li class=fn>int <a href="#screenNumber"><b>screenNumber</b></a> ( QWidget&nbsp;*&nbsp;widget = 0 ) const</li>
<li class=fn>int <a href="#screenNumber-2"><b>screenNumber</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;point ) const</li>
<li class=fn>QWidget * <a href="#screen"><b>screen</b></a> ( int&nbsp;screen = -1 )</li>
<li class=fn>const QRect &amp; <a href="#screenGeometry"><b>screenGeometry</b></a> ( int&nbsp;screen = -1 ) const</li>
<li class=fn>const QRect &amp; <a href="#screenGeometry-2"><b>screenGeometry</b></a> ( QWidget&nbsp;*&nbsp;widget ) const</li>
<li class=fn>const QRect &amp; <a href="#screenGeometry-3"><b>screenGeometry</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) const</li>
<li class=fn>const QRect &amp; <a href="#availableGeometry"><b>availableGeometry</b></a> ( int&nbsp;screen = -1 ) const</li>
<li class=fn>const QRect &amp; <a href="#availableGeometry-2"><b>availableGeometry</b></a> ( QWidget&nbsp;*&nbsp;widget ) const</li>
<li class=fn>const QRect &amp; <a href="#availableGeometry-3"><b>availableGeometry</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) const</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#resized"><b>resized</b></a> ( int&nbsp;screen )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QDesktopWidget class provides access to screen information on multi-head systems.
<p> 

<p> Systems with more than one graphics card and monitor can manage the
physical screen space available either as multiple desktops, or as a
large virtual desktop, which usually has the size of the bounding
rectangle of all the screens (see <a href="#isVirtualDesktop">isVirtualDesktop</a>()). For an
application, one of the available screens is the primary screen, i.e.
the screen where the main widget resides (see <a href="#primaryScreen">primaryScreen</a>()). All
windows opened in the context of the application must be
constrained to the boundaries of the primary screen; for example,
it would be inconvenient if a dialog box popped up on a different
screen, or split over two screens.
<p> The QDesktopWidget provides information about the geometry of the
available screens with <a href="#screenGeometry">screenGeometry</a>(). The number of screens
available is returned by <a href="#numScreens">numScreens</a>(). The screen number that a
particular point or widget is located in is returned by
<a href="#screenNumber">screenNumber</a>().
<p> Widgets provided by Qt use this class, for example, to place
tooltips, menus and dialog boxes according to the parent or
application widget.
<p> Applications can use this class to save window positions, or to place
child widgets on one screen.
<p> <center><img src="qdesktopwidget.png" alt="Managing Multiple Screens"></center> 
<p> In the illustration above, Application One's primary screen is
screen 0, and App Two's primary screen is screen 1.
<p> <p>See also <a href="advanced.html">Advanced Widgets</a> and <a href="environment.html">Environment Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QDesktopWidget"></a>QDesktopWidget::QDesktopWidget ()
</h3>
Creates the desktop widget.
<p> If the system supports a virtual desktop, this widget will have
the size of the virtual desktop; otherwise this widget will have
the size of the primary screen.
<p> Instead of using QDesktopWidget directly, use
<a href="qapplication.html#desktop">QApplication::desktop</a>().

<h3 class=fn><a name="~QDesktopWidget"></a>QDesktopWidget::~QDesktopWidget ()
</h3>
Destroy the object and free allocated resources.

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="availableGeometry"></a>QDesktopWidget::availableGeometry ( int&nbsp;screen = -1 ) const
</h3>
Returns the available geometry of the screen with index <em>screen</em>. What
is available will be subrect of <a href="#screenGeometry">screenGeometry</a>() based on what the
platform decides is available (for example excludes the Dock and Menubar
on Mac OS X, or the taskbar on Windows).
<p> <p>See also <a href="#screenNumber">screenNumber</a>() and <a href="#screenGeometry">screenGeometry</a>().

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="availableGeometry-2"></a>QDesktopWidget::availableGeometry ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the available geometry of the screen which contains <em>widget</em>.
<p> <p>See also <a href="#screenGeometry">screenGeometry</a>().

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="availableGeometry-3"></a>QDesktopWidget::availableGeometry ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the available geometry of the screen which contains <em>p</em>.
<p> <p>See also <a href="#screenGeometry">screenGeometry</a>().

<h3 class=fn>bool <a name="isVirtualDesktop"></a>QDesktopWidget::isVirtualDesktop () const
</h3>
Returns TRUE if the system manages the available screens in a
virtual desktop; otherwise returns FALSE.
<p> For virtual desktops, <a href="#screen">screen</a>() will always return the same widget.
The size of the virtual desktop is the size of this desktop
widget.

<h3 class=fn>int <a name="numScreens"></a>QDesktopWidget::numScreens () const
</h3>
Returns the number of available screens.
<p> <p>See also <a href="#primaryScreen">primaryScreen</a>().

<h3 class=fn>int <a name="primaryScreen"></a>QDesktopWidget::primaryScreen () const
</h3>
Returns the index of the primary screen.
<p> <p>See also <a href="#numScreens">numScreens</a>().

<h3 class=fn>void <a name="resized"></a>QDesktopWidget::resized ( int&nbsp;screen )<tt> [signal]</tt>
</h3> 
This signal is emitted when the size of <em>screen</em> changes.

<h3 class=fn><a href="qwidget.html">QWidget</a>&nbsp;* <a name="screen"></a>QDesktopWidget::screen ( int&nbsp;screen = -1 )
</h3>
Returns a widget that represents the screen with index <em>screen</em>.
This widget can be used to draw directly on the desktop, using an
unclipped painter like this:
<p> <pre>
    <a href="qpainter.html">QPainter</a> paint( QApplication::<a href="qapplication.html#desktop">desktop</a>()-&gt;screen( 0 ), TRUE );
    paint.draw...
    ...
    paint.<a href="qpainter.html#end">end</a>();
    </pre>
 
<p> If the system uses a virtual desktop, the returned widget will
have the geometry of the entire virtual desktop i.e. bounding
every <em>screen</em>.
<p> <p>See also <a href="#primaryScreen">primaryScreen</a>(), <a href="#numScreens">numScreens</a>(), and <a href="#isVirtualDesktop">isVirtualDesktop</a>().

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="screenGeometry"></a>QDesktopWidget::screenGeometry ( int&nbsp;screen = -1 ) const
</h3>
Returns the geometry of the screen with index <em>screen</em>.
<p> <p>See also <a href="#screenNumber">screenNumber</a>().

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="screenGeometry-2"></a>QDesktopWidget::screenGeometry ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the geometry of the screen which contains <em>widget</em>.

<h3 class=fn>const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp; <a name="screenGeometry-3"></a>QDesktopWidget::screenGeometry ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the geometry of the screen which contains <em>p</em>.

<h3 class=fn>int <a name="screenNumber"></a>QDesktopWidget::screenNumber ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;widget = 0 ) const
</h3>
Returns the index of the screen that contains the largest
part of <em>widget</em>, or -1 if the widget not on a screen.
<p> <p>See also <a href="#primaryScreen">primaryScreen</a>().

<h3 class=fn>int <a name="screenNumber-2"></a>QDesktopWidget::screenNumber ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;point ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the index of the screen that contains <em>point</em>, or -1 if
no screen contains the point.
<p> <p>See also <a href="#primaryScreen">primaryScreen</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>