summaryrefslogtreecommitdiff
path: root/src/qml/doc/snippets/code
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2022-03-07 17:36:48 +0800
committerShawn Rutledge <shawn.rutledge@qt.io>2022-07-08 09:22:05 +0200
commit2483ffa011f22b6d2120c73021a59d222a98aa52 (patch)
treee59ac959bae6fe3d45343d6f57811f3f8d42a9c5 /src/qml/doc/snippets/code
parent8310c3cba7b2b365a408e8a3743f9dd0c2e78531 (diff)
downloadqtdeclarative-2483ffa011f22b6d2120c73021a59d222a98aa52.tar.gz
Let Controls inherit palettes and fonts from parents
The Item's palette property and Control's font property returns the resolved value; its resolveMask is inherited from parent object, when the return value is used in the qml. For example: ApplicationWindow { id: window palette { window: "blue"; windowText: "blue" } Control { id: control } Button { onClicked: { control.palette.window = "red" window.palette.windowText = "red" console.log(control.palette.windowText) } } } In Button.onClicked, `control.palette` is the `resolvedPalette` of Control, it's resolveMask is not 0. Next, the new value is assigned to the control, then the control's "requestedPalette" will change to the new value, and it's resolveMask also is not 0. Next, `window.palette.windowText = "red"` changes the `windowText` palette for the window; QQuickPaletteColorProvider::inheritPalette() will be called. Because the resolveMask of `requestedPalette` is equal to the new palette, the control will not inherit any colors from its parent. So `console.log(control.palette.windowText)` was printing `qml: #0000ff`, but the right result is `qml: #ff0000`. When PaletteProvider is missing the inherited struct, fallbackPalette is now used as parentPalette. [ChangeLog][Controls] Controls now inherit palette and font from parents. Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Done-With: yeshanshan <yeshanshan@uniontech.com> Done-With: Shawn Rutledge <shawn.rutledge@qt.io> Pick-to: 6.4 Fixes: QTBUG-101480 Change-Id: Ibe400f647512331352bf34dee42f908fb7a8d914 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/qml/doc/snippets/code')
0 files changed, 0 insertions, 0 deletions