summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/textdocument-lists/main.cpp
blob: 96dc33e8bc825f1b59b3be2eea2b63816fda945f (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
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the either Technology Preview License Agreement or the
** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/

#include <QtGui>

#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MainWindow *window = new MainWindow;
    window->resize(640, 480);
    window->show();
    return app.exec();
}
99ef90a6 Tk is a free and open-source, cross-platform widget toolkit that provides a library of basic elements of GUI widgets for building a graphical user interface (GUI) in many programming languages.
summaryrefslogtreecommitdiffstats
path: root/doc/grid.n
blob: 1bd91211129aed307c810da1a098d593a2abb48b (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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
'\"
'\" Copyright (c) 1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" RCS: @(#) $Id: grid.n,v 1.2 1998/09/14 18:22:56 stanton Exp $
'\" 
.so man.macros
.TH grid n 4.1 Tk "Tk Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
grid \- Geometry manager that arranges widgets in a grid
.SH SYNOPSIS
\fBgrid \fIoption arg \fR?\fIarg ...\fR?
.BE

.SH DESCRIPTION
.PP
The \fBgrid\fR command is used to communicate with the grid
geometry manager that arranges widgets in rows and columns inside
of another window, called the geometry master (or master window).
The \fBgrid\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
\fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
If the first argument to \fBgrid\fR is a window name (any value
starting with ``.''), then the command is processed in the same
way as \fBgrid configure\fR.
.TP
\fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
With no arguments, 
the bounding box (in pixels) of the grid is returned.
The return value consists of 4 integers.  The first two are the pixel
offset from the master window (x then y) of the top-left corner of the
grid, and the second two integers are the width and height of the grid,
also in pixels.  If a single \fIcolumn\fP and \fIrow\fP is specified on 
the command line, then the bounding box for that cell is returned, where the
top left cell is numbered from zero.  If both \fIcolumn\fP and \fIrow\fP
arguments are specified, then the bounding box spanning the rows and columns
indicated is returned.
.TP
\fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR?
Query or set the column properties of the \fIindex\fP column of the 
geometry master, \fImaster\fP.
The valid options are \fB\-minsize\fP, \fB\-weight\fP and \fB-pad\fP.
.VS
If one or more options are provided, then \fIindex\fP may be given as 
a list of column indeces to which the configuration options will operate on.
.VE
The \fB\-minsize\fP option sets the minimum size, in screen units,
that will be permitted for this column.
The \fB\-weight\fP option (an integer value)
sets the relative weight for apportioning
any extra spaces among
columns.
A weight of zero (0) indicates the column will not deviate from its requested
size.  A column whose weight is two will grow at twice the rate as a column
of weight one when extra space is allocated to the layout.
The \fB-pad\fP option specifies the number of screen units that will be
added to the largest window contained completely in that column when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
are returned in an list of "-option value" pairs.
.TP
\fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
The arguments consist of the names of one or more slave windows
followed by pairs of arguments that specify how
to manage the slaves.
The characters \fB\-\fP,  \fBx\fP and \fB^\fP, 
can be specified instead of a window name to alter the default
location of a \fIslave\fP, as described in the ``RELATIVE PLACEMENT''
section, below.
The following options are supported:
.RS
.TP
\fB\-column \fIn\fR
Insert the slave so that it occupies the \fIn\fPth column in the grid.
Column numbers start with 0.  If this option is not supplied, then the
slave is arranged just to the right of previous slave specified on this
call to \fIgrid\fP, or column "0" if it is the first slave.  For each
\fBx\fP that immediately precedes the \fIslave\fP, the column position
is incremented by one.  Thus the \fBx\fP represents a blank column
for this row in the grid.
.TP
\fB\-columnspan \fIn\fR
Insert the slave so that it occupies \fIn\fP columns in the grid.
The default is one column, unless the window name is followed by a
\fB\-\fP, in which case the columnspan is incremented once for each immediately
following \fB\-\fP.
.TP
\fB\-in \fIother\fR
Insert the slave(s) in the master
window given by \fIother\fR.  The default is the first slave's
parent window.
.TP
\fB\-ipadx \fIamount\fR
The \fIamount\fR specifies how much horizontal internal padding to
leave on each side of the slave(s).  This is space is added
inside the slave(s) border.
The \fIamount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
It defaults to 0.
.TP
\fB\-ipady \fIamount\fR
The \fIamount\fR specifies how much vertical internal padding to
leave on on the top and bottom of the slave(s).
This space is added inside the slave(s) border.
The \fIamount\fR  defaults to 0.
.TP
\fB\-padx \fIamount\fR
The \fIamount\fR specifies how much horizontal external padding to
leave on each side of the slave(s), in screen units.
The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
.TP
\fB\-pady \fIamount\fR
The \fIamount\fR specifies how much vertical external padding to
leave on the top and bottom of the slave(s), in screen units.
The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
.TP
\fB\-row \fIn\fR
Insert the slave so that it occupies the \fIn\fPth row in the grid.
Row numbers start with 0.  If this option is not supplied, then the
slave is arranged on the same row as the previous slave specified on this
call to \fBgrid\fP, or the first unoccupied row if this is the first slave.
.TP
\fB\-rowspan \fIn\fR
Insert the slave so that it occupies \fIn\fP rows in the grid.
The default is one row.  If the next \fBgrid\fP command contains
\fB^\fP characters instead of \fIslaves\fP that line up with the columns
of this \fIslave\fP, then the \fBrowspan\fP of this \fIslave\fP is
extended by one.
.TP
\fB\-sticky \fIstyle\fR
If a slave's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the slave within its cell.
\fIStyle\fR  is a string that contains zero or more of the characters
\fBn\fP, \fBs\fP, \fBe\fP or \fBw\fP.
The string can optionally contains spaces or
commas, but they are ignored.  Each letter refers to a side (north, south,
east, or west) that the slave will "stick" to.  If both \fBn\fP and \fBs\fP (or
\fBe\fP and \fBw\fP) are specified, the slave will be stretched to fill the entire
height (or width) of its cavity.  The \fBsticky\fP option subsumes the
combination of \fB\-anchor\fP and \fB\-fill\fP that is used by \fBpack\fP.
The default is \fB{}\fP, which causes the slave to be centered in its cavity,
at its requested size.
.LP
If any of the slaves are already managed by the geometry manager
then any unspecified options for them retain their previous values rather
than receiving default values.
.RE
.TP
\fBgrid forget \fIslave \fR?\fIslave ...\fR?
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
The configuration options for that window are forgotten, so that if the
slave is managed once more by the grid geometry manager, the initial
default settings are used.
.TP
\fBgrid info \fIslave\fR
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
might be specified to \fBgrid configure\fR.
The first two elements of the list are ``\fB\-in \fImaster\fR'' where
\fImaster\fR is the slave's master.
.TP
\fBgrid location \fImaster x y\fR
Given  \fIx\fP and \fIy\fP values in screen units relative to the master window, 
the column and row number at that \fIx\fP and \fIy\fP location is returned.
For locations that are above or to the left of the grid, \fB-1\fP is returned.
.TP
\fBgrid propagate \fImaster\fR ?\fIboolean\fR?
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
then propagation is enabled for \fImaster\fR, which must be a window
name (see ``GEOMETRY PROPAGATION'' below).
If \fIboolean\fR has a false boolean value then propagation is
disabled for \fImaster\fR.
In either of these cases an empty string is returned.
If \fIboolean\fR is omitted then the command returns \fB0\fR or
\fB1\fR to indicate whether propagation is currently enabled
for \fImaster\fR.
Propagation is enabled by default.
.TP
\fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR?
Query or set the row properties of the \fIindex\fP row of the 
geometry master, \fImaster\fP.
The valid options are \fB\-minsize\fP, \fB\-weight\fP and \fB-pad\fP.
.VS
If one or more options are provided, then \fIindex\fP may be given as 
a list of row indeces to which the configuration options will operate on.
.VE
The \fB\-minsize\fP option sets the minimum size, in screen units,
that will be permitted for this row.
The \fB\-weight\fP option (an integer value)
sets the relative weight for apportioning
any extra spaces among
rows.
A weight of zero (0) indicates the row will not deviate from its requested
size.  A row whose weight is two will grow at twice the rate as a row
of weight one when extra space is allocated to the layout.
The \fB-pad\fP option specifies the number of screen units that will be
added to the largest window contained completely in that row when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
If only the master window and index is specified, all the current settings
are returned in an list of "-option value" pairs.
.TP
\fBgrid remove \fIslave \fR?\fIslave ...\fR?
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
However, the configuration options for that window are remembered,
so that if the
slave is managed once more by the grid geometry manager, the previous
values are retained.
.TP
\fBgrid size \fImaster\fR
Returns the size of the grid (in columns then rows) for \fImaster\fP.
The size is determined either by the \fIslave\fP occupying the largest
row or column, or the largest column or row with a \fBminsize\fP, 
\fBweight\fP, or \fBpad\fP that is non-zero.
.TP
\fBgrid slaves \fImaster\fR ?\fI\-option value\fR?
If no options are supplied, a list of all of the slaves in \fImaster\fR