Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99672

QPalette + resolve mask issue under Qt6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.2.2
    • GUI: Painting
    • None
    • All

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vhilshei Volker Hilsheimer
              besd Dmitry Beskorovainov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes