qt5base-lts/examples/widgets
Tor Arne Vestbø 0a93db4d82 Unify application palette handling between QGuiApplication and QApplication
The logic is now mostly handled in QGuiApplication, with QApplication
only dealing with the widget-specific palettes and interaction between
the style and the palette.

The application now picks up changes to the platform theme and will
re-resolve the current application palette appropriately. This also
works even if an explicit application palette has been set, in which
case any missing roles are filled in by the theme.

The palette can now also be reset back to the default application
palette that's fully based on the theme, by passing in the default
constructed palette (or any palette that doesn't have any roles set).
This is also correctly reflected in the Qt::AA_SetPalette attribute.

Conceptually this means QGuiApplication and QApplication follow the
same behavior as QWidget, where the palette falls back to a base or
inherited palette for roles that are not set, in this case the theme.

Behavior-wise this means that the default application palette of the
application does not have any roles set, but clients should not have
relied on this, nor does QWidget rely on that internally.

It also means that setting a palette on the application and then
getting it back again will not produce the same palette as set,
since the palette was resolved against the theme in the meantime.
This is the same behavior as for QWidget, and although it's a
behavior change it's one towards a more sane behavior, so we
accept it.

[ChangeLog] Application palettes are now resolved against the platform's
theme palette, the same way widget palettes are resolved against their
parents, and the application palette. This means the application palette
reflected through QGuiApplication::palette() may not be exactly the same
palette as set via QGuiApplication::setPalette().

Change-Id: I76b99fcd27285e564899548349aa2a5713e5965d
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-13 16:53:05 +01:00
..
animation Sub-Attaq: Fix compilation with -no-opengl 2019-11-18 15:45:41 +01:00
desktop Doc: Correct qdoc compilation errors qtbase 2020-01-09 02:33:08 +01:00
dialogs Deprecate constructing QFlags from a pointer 2019-11-20 19:43:38 +01:00
doc Merge remote-tracking branch 'origin/5.14' into 5.15 2020-01-09 20:30:39 +01:00
draganddrop QtWidgets/D&D/dropsite example: Add copy functionality 2019-09-05 10:50:49 +02:00
effects Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
gallery Add a widget gallery example 2020-01-09 13:52:25 +01:00
gestures Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
graphicsview Deprecate constructing QFlags from a pointer 2019-11-20 19:43:38 +01:00
itemviews Widget examples: replace QItemDelegate with QStyledItemDelegate 2019-10-28 19:36:32 +02:00
layouts Deprecate constructing QFlags from a pointer 2019-11-20 19:43:38 +01:00
mac macOS: Make QMacNativeWidget example more usable 2017-02-12 12:29:55 +00:00
mainwindows Deprecate constructing QFlags from a pointer 2019-11-20 19:43:38 +01:00
painting Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
qnx/foreignwindows Basic foreign window support for QNX 2019-05-01 13:49:18 +00:00
richtext Prepare for deprecating the QDesktopWidget 2019-10-15 20:09:29 +02:00
scroller Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
statemachine Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
tools Replace usages of QVariant::value by qvariant_cast 2019-12-15 12:30:52 +01:00
touch Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
tutorials Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
widgets Unify application palette handling between QGuiApplication and QApplication 2020-01-13 16:53:05 +01:00
windowcontainer Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
widgets.pro Add a widget gallery example 2020-01-09 13:52:25 +01:00