Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qt6-changes.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page widgets-changes-qt6.html
6 \title Changes to Qt Widgets
7 \ingroup changes-qt-5-to-6
8 \brief Changes in Kernel classes, Widgets, ItemViews, and Utility Classes.
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 Widgets, and provide
18 guidance to handle them.
19
20 \section1 Kernel classes
21
22 \section2 The QWidget class
23
24 The virtual QWidget::enterEvent() handler now receives a QEnterEvent*
25 parameter which has information about the pointer position, rather than
26 a plain QEvent*.
27
28 \section2 QDesktopWidget and QApplication::desktop()
29
30 QDesktopWidget was already deprecated in Qt 5, and has been removed in
31 Qt 6, together with QApplication::desktop().
32
33 QScreen provides equivalent functionality to query for information about
34 available screens, screen that form a virtual desktop, and screen
35 geometries.
36
37 Use QWidget::setScreen() to create a QWidget on a specific display;
38 note that this does not move a widget to a screen in a virtual desktop
39 setup.
40
41 \section2 QAction, QActionGroup
42
43 These classes have been moved into the QtGui module. Member functions that
44 depend on types defined in QtWidgets (such as QAction::menu() and
45 QAction::setMenu()) are implemented as templates that will be instantiated
46 only when called.
47
48 \section1 Widgets
49
50 \section2 The QAbstractButton class
51
52 The default timeout parameter for QAbstractButton::animateClick() is
53 removed to allow modern connection syntax without the need for qOverload.
54
55 \section2 The QComboBox class
56
57 The QComboBox::setModel() function is now virtual.
58
59 \section2 The QDateTimeEdit class
60
61 When QDateTimeEdit::setDateTime() is called with a date-time whose
62 time-spec doesn't match that of the QDateTimeEdit instance, the
63 date-time is converted to the time-spec of the QDateTimeEdit. This
64 gives a date-time that describes the same instant in time, but
65 does so in the same terms as the QDateTimeEdit uses. Previously,
66 the date and time from the passed date-time were combined with the
67 time-spec of the widget, ignoring the time-spec of the date-time;
68 this could describe a different point in time than the one
69 described by the date-time passed.
70
71 \section1 ItemViews
72
73 \section2 The QAbstractItemView class
74
75 The virtual viewOptions() method that previously returned a QStyleOptionViewItem
76 object has been renamed to initViewItemOption, and initializes a
77 QStyleOptionViewItem object that's passed in through a pointer.
78
79 \section1 Styling Classes and related APIs
80
81 All versioned QStyleOption subclasses are consolidated, and the version
82 numbers are reset to 1.
83
84 The various initStyleOption() methods in widget classes are now virtual.
85
86 \section2 Style sheet changes
87
88 Styling a widget by its property in Qt 5 vs Qt 6 is different, especially if the
89 property is an enum. In Qt 5, the selector value for such a property is the integer
90 equivalent of the enum value, while in Qt 6 the string value is used. The following
91 example demonstrates this difference:
92
93 \code
94 // Qt 5 style sheet
95 QToolButton[popupMode="1"] {
96 padding-right: 20px;
97 }
98 \endcode
99
100 \code
101 // Qt 6 style sheet
102 QToolButton[popupMode=MenuButtonPopup] {
103 padding-right: 20px;
104 }
105 \endcode
106
107 \section1 Utility Classes
108
109 \section2 QUndoCommand, QUndoStack, and QUndoGroup
110
111 The widget independent classes of the Undo/Redo framework have been moved
112 into the QtGui module.
113*/