Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt6-changes.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page gui-changes-qt6.html
6
\title Changes to Qt GUI
7
\ingroup changes-qt-5-to-6
8
\brief Kernel, Text, Painting, and Utility classes are modified.
9
10
Qt 6 is a result of the conscious effort to make the framework more
11
efficient and easy to use.
12
13
We try to maintain binary and source compatibility for all the public
14
APIs in each release. But some changes were inevitable in an effort to
15
make Qt a better framework.
16
17
In this topic we summarize those changes in Qt GUI, and provide
18
guidance to handle them.
19
20
\section1 Kernel classes
21
22
\section2 The QBitmap class
23
24
Implicit construction of a QBitmap from a QPixmap is no longer supported.
25
The constructor and assignment operator have been made explicit and marked as
26
deprecated. Use the new static factory function \l{QBitmap::}{fromPixmap} instead.
27
28
\section2 The QCursor class
29
30
Implicit construction of a QCursor from a QPixmap is no longer supported, the
31
constructor has been made explicit.
32
33
\section2 The QKeyCombination class
34
35
QKeyCombination is a new class for storing a combination of a key with an
36
optional modifier. It should be used as a replacement for combining values from
37
the Qt::Key enum with a modifier in a type-safe way.
38
39
We recommend migrating code that currently uses operator+() to combine a key and
40
modifiers, as future C++ standards are likely to declare arithmetic operations
41
between unrelated enumeration types as illegal. Use operator|(), and change
42
APIs that expect an \c int to expect a QKeyCombination instead.
43
44
Existing APIs that expect an \c int for a key combination can be called using
45
QKeyCombination::toCombined().
46
47
\section1 Text classes
48
49
\section2 The QFontDatabase class
50
51
The QFontDatabase class has now only static member functions. The constructor
52
has been deprecated. Instead of e.g.
53
54
\code
55
const QStringList fontFamilies = QFontDatabase().families();
56
\endcode
57
58
use
59
60
\code
61
const QStringList fontFamilies = QFontDatabase::families();
62
\endcode
63
64
\section2 The QFont class
65
66
The numerical values of the QFont::Weight enumerator have been changed to
67
be in line with OpenType weight values. QFont::setWeight() expects an enum value
68
instead of an \c int, and code that calls the setter with an integer will fail to
69
compile. To continue to use old integer values, use QFont::setLegacyWeight().
70
71
\section1 Painting classes
72
73
See the porting guide for \l{Changes to Qt Print Support}{Qt Print Support} for
74
information about \l{QPagedPaintDevice} and other printing related classes.
75
76
\section1 Utility classes
77
78
\section2 QIntValidator and QDoubleValidator
79
80
The \l{QIntValidator::}{setRange()} method is no longer marked as virtual.
81
82
\section1 OpenGL classes
83
84
With the introduction of Qt RHI as the rendering foundation in Qt,
85
most classes prefixed by \c QOpenGL have been moved into the \l{Qt OpenGL}
86
module.
87
88
More details can be found in \l{Changes to Qt OpenGL}{the Qt OpenGL porting guide}.
89
90
One notable exception is the class \l QOpenGLContext, which still resides in
91
Qt GUI.
92
93
In addition, the class \l QOpenGLWidget has been moved to a new module, named
94
Qt OpenGL Widgets.
95
96
\section2 The QOpenGLContext class
97
98
The QOpenGLContext::versionFunctions() function is replaced by
99
QOpenGLVersionFunctionsFactory::get(). QOpenGLVersionFunctionsFactory is a public
100
class now, part of the \l{Qt OpenGL} module.
101
102
\section2 ANGLE
103
104
On Windows, ANGLE, a third-party OpenGL ES to Direct 3D translator, is no
105
longer included in Qt. This means Qt::AA_UseOpenGLES and the environment
106
variable \c{QT_OPENGL=angle} no longer have any effect.
107
In \l{Dynamically Loading OpenGL}{dynamic OpenGL builds} there is no automatic fallback to ANGLE in
108
case OpenGL proper fails to initialize. For QWindow or QWidget based
109
applications using OpenGL directly, for example via QOpenGLWidget, this means
110
that OpenGL proper is the only option at run time. However, the alternative of
111
using a pure software OpenGL implementation, such as Mesa llvmpipe that is
112
shipped with the pre-built Qt packages, is still available. For Qt Quick and Qt
113
Quick 3D applications, Qt 6 introduces support for Direct 3D 11, Vulkan, and
114
Metal, in addition to OpenGL. On Windows the default choice is Direct 3D,
115
therefore the removal of ANGLE is alleviated by having support for graphics
116
APIs other than OpenGL as well.
117
118
\section2 Native clipboard integration
119
120
Qt 5 provided interfaces for integrating platform specific or custom
121
clipboard formats into Qt through \c QMacPasteboardMime in \c QtMacExtras,
122
and \c QWindowsMime from the Windows QPA API. Since Qt 6.6, the
123
equivalent functionality is provided by the classes QUtiMimeConverter for
124
\macos, and the QWindowsMimeConverter for Windows.
125
126
Porting from QWindowsMime to QWindowsMimeConverter requires practically no
127
changes, as the virtual interface is identical. However, in Qt 6 it is no
128
longer needed to register a QWindowsMimeConverter implementation;
129
instantiating the type implicitly registers the converter.
130
131
Porting a QMacPasteboardMime to QUtiMimeConverter requires renaming some of
132
the virtual functions. Note that the \c{QMacPasteboardMime} API used the
133
outdated term \c{flavor} for the native clipboard format on \macos, whereas
134
the platform now uses \c{Uniform Type Identifiers}, i.e. \c{UTI}s, which Qt
135
has adapted for function and parameter names.
136
137
The \c{mimeFor} and \c{flavorFor} functions are replaced by the
138
\l{QUtiMimeConverter::}{mimeForUti} and \l{QUtiMimeConverter::}{utiForMime}
139
implementations, respectively. Those should return the name of the mime
140
type or \c{UTI} that the converter can convert the input format to, so a
141
port usually just involves renaming existing overrides. The
142
\c{convertToMime}, \c{convertFromMime}, and \c{count} functions in
143
QUtiMimeConverter are identical to their QMacPasteboardMime versions.
144
145
The \c{canConvert}, \c{converterName} functions are no longer needed, they
146
are implied by implementation of the above functions, so overrides of those
147
functions can be removed.
148
149
As with the the QWindowsMimeConverter, registration is done by instantiating
150
the type.
151
*/
qtbase
src
gui
doc
src
qt6-changes.qdoc
Generated on
for Qt by
1.14.0