Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
5.11, 5.12.0
-
-
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
- duplicates
-
QTBUG-72428 QLineEdit QSpinBox QDoubleSpinBox can not change background color 不能设置背景色彩
- Closed