qt5base-lts/tests/auto/widgets/kernel
Volker Hilsheimer 1821f5163d Fix font and palette propagation for themed children created at runtime
Widgets have a default palette and font that is influenced by several
factors: theme, style, QApplication-wide overrides, and the parent's.
If an application sets a font or palette on a parent, then widgets
inherit those settings, no matter when they are added to the parent.

The bug is that this is not true for widgets that have an application-
wide override defined by the platform theme. For those, we need to merge
parent palette and font attributes with the theme, and this is currently
not done correctly, as the respective masks are not merged and inherited.

This change fixes this for fonts and palettes. Children are inheriting
their parent's inheritance masks, combined with the mask for the
attributes set explicitly on the parent. This makes the font and palette
resolving code correctly adopt those attributes that are set explicily,
while leaving everything else as per the theme override.

The test verifies that this works for children and grand children added
to a widget that has a palette or font set, both when themed and
unthemed. Children with own entries don't inherit from parent.

The QFont::resetFont test had to be changed, as it was testing the
wrong behavior. If the child would be added to the parent before the
font property was set, then the test would have failed. Since this
change makes sure that children inherit fonts in the same way, no
matter on when they are added to their parent, the test is now
modified to cover both cases, and ensures that they return identical
results.

[ChangeLog][QtWidgets][QWidget] Fonts and palette settings are inherited
by children from their parents even if the children have application-
wide platform theme overrides.

Change-Id: I179a652b735e85bba3fafc30098d08d61684f488
Fixes: QTBUG-82125
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
2020-02-20 08:04:47 +01:00
..
qaction Widget tests: Skip tests that fail on Wayland 2019-10-18 10:53:34 +02:00
qactiongroup tst_QAction(Group): Brush up the tests 2019-06-28 00:24:40 +02:00
qapplication Widget tests: Skip tests that fail on Wayland 2019-10-18 10:53:34 +02:00
qboxlayout Avoid initializing QFlags with 0 or nullptr in tests 2019-11-26 09:08:51 +01:00
qdesktopwidget Remove usages of deprecated APIs of QDesktopWidget 2019-10-13 13:08:42 +02:00
qformlayout tst_QFormLayout: use QAutoPointer to simplify test and avoid leak 2019-08-13 17:26:11 +02:00
qgesturerecognizer tests: un-blacklist tst_QGestureRecognizer::panGesture on xcb 2018-06-25 13:41:40 +00:00
qgridlayout Remove usages of deprecated APIs of qtbase/widgets 2019-08-01 17:04:13 +00:00
qlayout Avoid initializing QFlags with 0 or nullptr in tests 2019-11-26 09:08:51 +01:00
qshortcut QShortcut: add pmf ctor overloads 2019-11-14 19:59:23 +01:00
qsizepolicy Fix tst_QSizePolicy::constExpr() to compile with MSVC 15.8.1 2018-08-30 06:23:51 +00:00
qstackedlayout Widget tests: Skip tests that fail on Wayland 2019-10-18 10:53:34 +02:00
qtooltip Widget tests: Skip tests that fail on Wayland 2019-10-18 10:53:34 +02:00
qwidget Fix font and palette propagation for themed children created at runtime 2020-02-20 08:04:47 +01:00
qwidget_window Try to stabilize tst_qwidget_qwindow::tst_resize_count on X11 2020-02-17 17:47:56 +01:00
qwidgetaction testlib: start sharing common helper functions 2017-11-04 20:11:22 +00:00
qwidgetmetatype Finish qmetatype migration to type switcher 2018-10-03 14:48:55 +00:00
qwidgetsvariant
qwindowcontainer Widget tests: Skip tests that fail on Wayland 2019-10-18 10:53:34 +02:00
kernel.pro Cleanup widgets/kernel.pro after modularization 2019-03-27 09:29:20 +00:00