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
|
'\" t
.TH QDesktopWidget 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QDesktopWidget \- Access to screen information on multi-head systems
.SH SYNOPSIS
\fC#include <qdesktopwidget.h>\fR
.PP
Inherits QWidget.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQDesktopWidget\fR ()"
.br
.ti -1c
.BI "\fB~QDesktopWidget\fR ()"
.br
.ti -1c
.BI "bool \fBisVirtualDesktop\fR () const"
.br
.ti -1c
.BI "int \fBnumScreens\fR () const"
.br
.ti -1c
.BI "int \fBprimaryScreen\fR () const"
.br
.ti -1c
.BI "int \fBscreenNumber\fR ( QWidget * widget = 0 ) const"
.br
.ti -1c
.BI "int \fBscreenNumber\fR ( const QPoint & point ) const"
.br
.ti -1c
.BI "QWidget * \fBscreen\fR ( int screen = -1 )"
.br
.ti -1c
.BI "const QRect & \fBscreenGeometry\fR ( int screen = -1 ) const"
.br
.ti -1c
.BI "const QRect & \fBscreenGeometry\fR ( QWidget * widget ) const"
.br
.ti -1c
.BI "const QRect & \fBscreenGeometry\fR ( const QPoint & p ) const"
.br
.ti -1c
.BI "const QRect & \fBavailableGeometry\fR ( int screen = -1 ) const"
.br
.ti -1c
.BI "const QRect & \fBavailableGeometry\fR ( QWidget * widget ) const"
.br
.ti -1c
.BI "const QRect & \fBavailableGeometry\fR ( const QPoint & p ) const"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBresized\fR ( int screen )"
.br
.in -1c
.SH DESCRIPTION
The QDesktopWidget class provides access to screen information on multi-head systems.
.PP
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 isVirtualDesktop()). For an application, one of the available screens is the primary screen, i.e. the screen where the main widget resides (see primaryScreen()). 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.
.PP
The QDesktopWidget provides information about the geometry of the available screens with screenGeometry(). The number of screens available is returned by numScreens(). The screen number that a particular point or widget is located in is returned by screenNumber().
.PP
Widgets provided by Qt use this class, for example, to place tooltips, menus and dialog boxes according to the parent or application widget.
.PP
Applications can use this class to save window positions, or to place child widgets on one screen.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
In the illustration above, Application One's primary screen is screen 0, and App Two's primary screen is screen 1.
.PP
See also Advanced Widgets and Environment Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QDesktopWidget::QDesktopWidget ()"
Creates the desktop widget.
.PP
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.
.PP
Instead of using QDesktopWidget directly, use QApplication::desktop().
.SH "QDesktopWidget::~QDesktopWidget ()"
Destroy the object and free allocated resources.
.SH "const QRect & QDesktopWidget::availableGeometry ( int screen = -1 ) const"
Returns the available geometry of the screen with index \fIscreen\fR. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the Dock and Menubar on Mac OS X, or the taskbar on Windows).
.PP
See also screenNumber() and screenGeometry().
.SH "const QRect & QDesktopWidget::availableGeometry ( QWidget * widget ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the available geometry of the screen which contains \fIwidget\fR.
.PP
See also screenGeometry().
.SH "const QRect & QDesktopWidget::availableGeometry ( const QPoint & p ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the available geometry of the screen which contains \fIp\fR.
.PP
See also screenGeometry().
.SH "bool QDesktopWidget::isVirtualDesktop () const"
Returns TRUE if the system manages the available screens in a virtual desktop; otherwise returns FALSE.
.PP
For virtual desktops, screen() will always return the same widget. The size of the virtual desktop is the size of this desktop widget.
.SH "int QDesktopWidget::numScreens () const"
Returns the number of available screens.
.PP
See also primaryScreen().
.SH "int QDesktopWidget::primaryScreen () const"
Returns the index of the primary screen.
.PP
See also numScreens().
.SH "void QDesktopWidget::resized ( int screen )\fC [signal]\fR"
This signal is emitted when the size of \fIscreen\fR changes.
.SH "QWidget * QDesktopWidget::screen ( int screen = -1 )"
Returns a widget that represents the screen with index \fIscreen\fR. This widget can be used to draw directly on the desktop, using an unclipped painter like this:
.PP
.nf
.br
QPainter paint( QApplication::desktop()->screen( 0 ), TRUE );
.br
paint.draw...
.br
...
.br
paint.end();
.br
.fi
.PP
If the system uses a virtual desktop, the returned widget will have the geometry of the entire virtual desktop i.e. bounding every \fIscreen\fR.
.PP
See also primaryScreen(), numScreens(), and isVirtualDesktop().
.SH "const QRect & QDesktopWidget::screenGeometry ( int screen = -1 ) const"
Returns the geometry of the screen with index \fIscreen\fR.
.PP
See also screenNumber().
.SH "const QRect & QDesktopWidget::screenGeometry ( QWidget * widget ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the geometry of the screen which contains \fIwidget\fR.
.SH "const QRect & QDesktopWidget::screenGeometry ( const QPoint & p ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the geometry of the screen which contains \fIp\fR.
.SH "int QDesktopWidget::screenNumber ( QWidget * widget = 0 ) const"
Returns the index of the screen that contains the largest part of \fIwidget\fR, or -1 if the widget not on a screen.
.PP
See also primaryScreen().
.SH "int QDesktopWidget::screenNumber ( const QPoint & point ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the index of the screen that contains \fIpoint\fR, or -1 if no screen contains the point.
.PP
See also primaryScreen().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qdesktopwidget.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qdesktopwidget.3qt) and the Qt
version (3.3.8).
|