Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
6.0.0
-
None
Description
I found the commit https://github.com/qt/qtdeclarative/commit/1875ad7f92cad270cc5857d71096a4b46c27c562, is refactor the palette for QtQuick.
In a custom style plug-in, how should I set the default color palette for a certain type of control? such as:
eg: custom style Slider.qml import QtQuick.Templates as T import QtQuick.Controls.CustomStyle as MyStyle T. Slider { id: control // palette: MyStyle.sliderPalette background: Rectangle { color: control.palette.background // color: MyStyle.sliderBackground } }
By default, this Slider control will inherit the palette from the parent item, but I want it to have a different background color, maybe I can set the palette property for T.Slider, like "palette: MyStyle.sliderPalette", but in current, I need to resolve MyStyle.sliderPalette according to the palette of the parent item, by the palette background color of parent item to judgment it is Dark or Light color. I found that in the Material plug-in, It gave up using the palette of T.Slider, but directly used "Material.accentColor" to set the color for the Rectangle of the background item. This is usually It is not a good way. When MyStyle is set as the default plugin by the system, the user will found that the palette colors he set for Slider in the codes does not working.