Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Stylesheet background color bug in Windows 8.0/8.1
tomq last edited by
I am currently migrating two large applications from windows 7 to windows 8.0/8.1.
I've encountered the following bug: when a QLineEdit has a background color set (through a stylesheet), and the mouse hovers over it, the background color changes to white for about 1 or 2 seconds. This occurs in release and debug, regardless of whether a debugger is attached or not.
The Qt configuration is Qt 4.8.4 with MinGW 4.4.
I have made a toy project to reproduce the issue, I am only reproducing the code for the main window source file:
WidgetBackgroundMainWindow::WidgetBackgroundMainWindow(QWidget *parent) :
m_central = new QWidget();
m_layout = new QVBoxLayout(); m_central->setLayout(m_layout); m_lineEdit1 = new QLineEdit(); m_lineEdit2 = new QLineEdit(); m_layout->addWidget(m_lineEdit1); m_layout->addWidget(m_lineEdit2); m_lineEdit1->setStyleSheet("background-color:#888888;"); //gray m_lineEdit2->setStyleSheet("background-color:#13579B;"); //blue
I have tried setting a background color in case of hovering in the stylesheets, but this has no effect on the bug (the background first turns to white for 1 or 2 seconds, and then, if the mouse is still over the widget, it turns to the specified color).
This seems to be fairly basic code, and it works perfectly in Windows 7, so my guess is that there is a compatibility problem with Windows 8, which may have gone undetected because it is invisible if the background is white to begin with. Does anyone have any ideas as to the root of the problem, and/or a possible fix?
I'm including below a few screenshots illustrating the issue, based on the code shown above:
i currently can't try this and look for a fix.
But note Windows 8 is not a Tier1 platform nor a Tier2. So officially Qt 4 isn't supported on Windows 8. Thus Digia doesn't run their tests on Windows 8.
tomq last edited by
Thanks. I understand that aspect, and upgrading to 5.2 will be inevitable eventually. Nonetheless, it would be great to be able to use qt 4.8.4 for a little longer.
Note: I could reproduce the same bug for Qt 4.8.5 with MS Visual Studio 2010, also in Windows 8.1. I did this to rule out bugs with 4.8.4 and mingw.
Valeologiya last edited by
Hi! I have the same problem with Qt 5.2.0 with MinGW 3.82.90 in Windows 8. I didn't try in other platforms. It seems that еhis problem don't depend of Qt version.
jmaurice last edited by
One workaround that worked for me was to disable the frame of the QLineEdit, then the background color stopped changing