Details
-
Bug
-
Resolution: Cannot Reproduce
-
P4: Low
-
None
-
4.8.6, 5.3.2
-
Windows 8 and 8.1
Qt 4.6 + VS2010
Qt 5.3.2 + VS2013
Note: Works on Windows 7
Description
On Windows 8 and 8.1, the background of QLineEdit controls is drawn using the default background color when the widget is grabbed (QWidget::grab() and QPixmap::grabWidget()).
Setting the background color via palette or stylesheet does not work.
Example
QLineEdit lineEdit;
QPalette palette = lineEdit.palette();
palette.setColor(QPalette::Window, QColor(Qt::red));
palette.setColor(QPalette::Base, QColor(Qt::red));
lineEdit.setPalette(palette);
lineEdit.setStyleSheet("background-color: red;");
QPixmap pix = lineEdit.grab();
I identified the bug when drawing an item delegate (test project attached).
It's perhaps linked to the bug QTBUG-40634, but it is not exactly identical since the background here is never drawn using the palette/stylesheet set, unlike the other bug where it is blinking when the QLineEdit is hovered.