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

[Reg] QLineEdit background color and background transparency does not work with QPalette on default Mac style

    XMLWordPrintable

Details

    • macOS
    • c4e7f3ab6555c87fb41c5f341524445283720e6a (qt/qtbase/5.12)

    Description

      Using QPalette to change QLineEdit background color and/or transparency does not work on Mac when using default "macintosh" style. This was observed with Mac OS High Sierra and Mac OS Mojave light mode, but seems to work as expected in Mojave dark mode.

      This was reproduced with Qt 5.11 and Qt 5.12, but seems to work with Qt 5.10 and older.

      Code snippet to set background color

      QLineEdit *le = new QLineEdit(this);
      QPalette pal = le->palette();
      pal.setColor( le->backgroundRole(), Qt::red );
      le->setPalette( pal );
      

      Code snippet to set transparency

      QLineEdit *le = new QLineEdit(this);
      QPalette p = le->palette();
      p.setColor( QPalette::Base, Qt::transparent );
      le->setPalette( p );
      

      Attachments

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              pekarjal Pekka Karjalainen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes