QtBase  v6.3.1
src_gui_kernel_qwidget.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the documentation of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** BSD License Usage
18 ** Alternatively, you may use this file under the terms of the BSD license
19 ** as follows:
20 **
21 ** "Redistribution and use in source and binary forms, with or without
22 ** modification, are permitted provided that the following conditions are
23 ** met:
24 ** * Redistributions of source code must retain the above copyright
25 ** notice, this list of conditions and the following disclaimer.
26 ** * Redistributions in binary form must reproduce the above copyright
27 ** notice, this list of conditions and the following disclaimer in
28 ** the documentation and/or other materials provided with the
29 ** distribution.
30 ** * Neither the name of The Qt Company Ltd nor the names of its
31 ** contributors may be used to endorse or promote products derived
32 ** from this software without specific prior written permission.
33 **
34 **
35 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
46 **
47 ** $QT_END_LICENSE$
48 **
49 ****************************************************************************/
50 
52 w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);
54 
55 
57 w->setWindowState((w->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
59 
60 
62 width = baseSize().width() + i * sizeIncrement().width();
63 height = baseSize().height() + j * sizeIncrement().height();
65 
66 
68 aWidget->window()->setWindowTitle("New Window Title");
70 
71 
73 QFont font("Helvetica", 12, QFont::Bold);
76 
77 
80 font.setBold(false);
81 setFont(font);
83 
84 
88 
89 
94 
95 
98 ...
99 painter.end();
100 myWidget->render(this);
102 
103 
105 setTabOrder(a, b); // a to b
106 setTabOrder(b, c); // a to b to c
107 setTabOrder(c, d); // a to b to c to d
109 
110 
112 // WRONG
113 setTabOrder(c, d); // c to d
114 setTabOrder(a, b); // a to b AND c to d
115 setTabOrder(b, c); // a to b to c, but not c to d
117 
118 
121 {
122  QSettings settings("MyCompany", "MyApp");
123  settings.setValue("geometry", saveGeometry());
125 }
127 
128 
130 QSettings settings("MyCompany", "MyApp");
131 myWidget->restoreGeometry(settings.value("myWidget/geometry").toByteArray());
133 
134 
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
The QCloseEvent class contains parameters that describe a close event.
Definition: qevent.h:629
The QFont class specifies a query for a font used for drawing text.
Definition: qfont.h:56
void setBold(bool)
Definition: qfont.h:335
@ Bold
Definition: qfont.h:103
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:82
The QPixmap class is an off-screen image representation that can be used as a paint device.
Definition: qpixmap.h:63
The QSettings class provides persistent platform-independent application settings.
Definition: qsettings.h:66
void setValue(const QString &key, const QVariant &value)
Definition: qsettings.cpp:3145
QVariant value(const QString &key, const QVariant &defaultValue) const
Definition: qsettings.cpp:3288
QByteArray toByteArray() const
Definition: qvariant.cpp:1519
virtual void closeEvent(QCloseEvent *event)
Definition: qwidget.cpp:9762
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:147
QByteArray saveGeometry() const
Definition: qwidget.cpp:7348
void render(QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
QOpenGLWidget * widget
[1]
@ WindowFullScreen
Definition: qnamespace.h:280
@ WindowMinimized
Definition: qnamespace.h:278
@ WindowActive
Definition: qnamespace.h:281
@ IBeamCursor
Definition: qnamespace.h:1181
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei width
struct _cl_event * event
Definition: qopenglext.h:2998
const GLubyte * c
Definition: qopenglext.h:12701
setUpdatesEnabled(false)
[12]
widget render & pixmap
setCursor(Qt::IBeamCursor)
[5]
QPainter painter(this)
[7]
setFont(font)
QSettings settings("MyCompany", "MyApp")
[11]
setTabOrder(a, b)
[8]
bigVisualChanges()
QFont font("Helvetica", 12, QFont::Bold)
[3]