qt6-changes.qdoc 4.36 KB
Newer Older
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
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page gui-changes-qt6.html
30 31
    \title Changes to Qt GUI
    \ingroup changes-qt-5-to-6
32 33 34 35 36 37 38 39 40 41 42 43
    \brief Migrate Qt GUI to Qt 6.

    Qt 6 is a result of the conscious effort to make the framework more
    efficient and easy to use.

    We try to maintain binary and source compatibility for all the public
    APIs in each release. But some changes were inevitable in an effort to
    make Qt a better framework.

    In this topic we summarize those changes in Qt GUI, and provide
    guidance to handle them.

44
    \section1 Kernel classes
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
    \section2 QBitmap

    Implicit construction of a QBitmap from a QPixmap is no longer supported.
    The constructor and assignment operator have been made explicit and marked as
    deprecated. Use the new static factory function \l{QBitmap::}{fromPixmap} instead.

    \section2 QCursor

    Implicit construction of a QCursor from a QPixmap is no longer supported, the
    constructor has been made explicit.

    \section2 QKeyCombination

    QKeyCombination is a new class for storing a combination of a key with an
    optional modifier. It should be used as a replacement for combining values from
    the Qt::Key enum with a modifier in a type-safe way.

    We recommend migrating code that currently uses operator+() to combine a key and
    modifiers, as future C++ standards are likely to declare arithmetic operations
    between unrelated enumeration types as illegal. Use operator|(), and change
    APIs that expect an \c int to expect a QKeyCombination instead.

    Existing APIs that expect an \c int for a key combination can be called using
    QKeyCombination::toCombined().

    \section1 Text classes

    \section2 QFontDatabase

    The QFontDatabase class has now only static member functions. The constructor
    has been deprecated. Instead of e.g.

    \code
    const QStringList fontFamilies = QFontDatabase().families();
    \endcode

    use

    \code
    const QStringList fontFamilies = QFontDatabase::families();
    \endcode

    \section2 QFont

    The numerical values of the QFont::Weight enumerator have been changed to
    be in line with OpenType weight values. QFont::setWeight() expects an enum value
    instead of an \c int, and code that calls the setter with an integer will fail to
    compile. To continue to use old integer values, use QFont::setLegacyWeight().

    \section1 Painting classes

97
    See the porting guide for \l{Changes to Qt Print Support}{Qt Print Support} for
98 99 100 101 102 103 104
    information about \l{QPagedPaintDevice} and other printing related classes.

    \section1 Utility classes

    \section2 QIntValidator and QDoubleValidator

    The \l{QIntValidator::}{setRange()} method is no longer marked as virtual.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

    \section1 OpenGL classes

    With the introduction of Qt RHI as the rendering foundation in Qt,
    most classes prefixed by \c QOpenGL have been moved into the \l{Qt OpenGL}
    module.

    More details can be found in \l{Changes to Qt OpenGL}{the Qt OpenGL porting guide}.

    One notable exception is the class \l QOpenGLContext, which still resides in
    Qt GUI.

    In addition, the class \l QOpenGLWidget has been moved to a new module, named
    Qt OpenGL Widgets.

120
*/