diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2024-03-14 08:48:56 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-29 05:11:42 +0000 |
commit | 29a75b99f43ce704ec68fc1650047c9db2fb2829 (patch) | |
tree | 847c88be53316743413d3ce0c3aac514d80db146 | |
parent | 1fc5527e2d9319e23dd7f419de216d60e90ac2c4 (diff) |
Documentation: Clarify palette/font/stylesheet inheritance/propagation
Palette and font changes made by a style sheet are propagated to
existing widgets and their children at change time.
Palette and font changes made by setPalette() and setFont() are
inherited by all existing and future children of the widget to which the
call was made.
Clarify this in the documentation.
Fixes: QTBUG-122588
Pick-to: 6.5 6.2 5.15
Change-Id: Ic40d96fc1e5e4507f84a33138303b7193948d3fe
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f2b681dc590c7fd3cd19cbde20363339ceae15f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 359b648280270ab80d032cb6efc76516efcd2023)
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 6 | ||||
-rw-r--r-- | src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 867897f99e..4d5c8b255f 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -191,9 +191,9 @@ \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets disable regular QWidget palette and font propagation. When this flag - is enabled, font and palette changes propagate as though the user had - manually called the corresponding QWidget methods. See - \l{The Style Sheet Syntax#Inheritance}{The Style Sheet Syntax - Inheritance} + is enabled, font and palette changes done from a style sheet will propagate + a single time, when the style sheet is set. + See \l{The Style Sheet Syntax#Inheritance}{The Style Sheet Syntax - Inheritance} for more details. This value was added in Qt 5.7. diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index d426a52051..2e018961e6 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -480,11 +480,20 @@ \snippet code/doc_src_stylesheet.cpp 96 When the widget-style font and palette propagation is enabled, font and - palette changes made through Qt Style Sheets will behave as though the - user had manually called the corresponding QWidget::setPalette() and + palette changes made through Qt Style Sheets will behave as if the user + had manually called the corresponding QWidget::setPalette() and QWidget::setFont() methods on all of the QWidgets targeted by the style - sheet. If this would have caused propagation in C++, it will cause - propagation in style sheets and vice versa. + sheet. + + \list + \li Changes made by a style sheet are propagated. + They are pushed to all widgets matching the style sheet once, at the time + the change is made. + \li Changes made by calling QWidget::setPalette() or QWidget::setFont() are + inherited. + They are inherited by all existing and future children, where the respective + brush or font hasn't been explicitly set. + \endlist \section1 Widgets Inside C++ Namespaces |