Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.2.2
-
None
Description
When we are trying to set the color in the palette, identical to that is now in the palette (same color value, role, group), the ResolveMask flag is enabled for the changed role for all palettes that have not been detached. As a result, all the code that is tied to the resolve_mask flag does not work correctly. The problem is that the In Qt5 mask was stored in the Data field of the palette object. And in Qt6, it is stored in a private part of the palette - QPalettePrivate, which is shared between all palettes and is detached only if the color value changed. To reproduce the issue use the code below:
QApplication application(argc, argv);
bool isBrushSet = application.palette().isBrushSet(QPalette::Active, QPalette::Window);
//isBrushSet is FALSE at this point
QWidget widget;
QPalette p = widget.palette();
p.setColor(QPalette::Active, QPalette::Window, p.color(QPalette::Window));
isBrushSet = application.palette().isBrushSet(QPalette::Active, QPalette::Window);
//isBrushSet is TRUE at this point
widget.show();
return application.exec();
I think you have to detach() the palette in any case then the color is changed. Or if the color value is the same do not set the mask flag.
P.S. For QFont there is the same problem.
Attachments
Issue Links
- duplicates
-
QTBUG-98762 REGRESSION: QPalette::setBrush does not reliably detach
- Closed