This strange thing initially happened in LXQt project, you may see discussion here https://github.com/lxde/lxqt/issues/1109 However, I've figured out that this looks like Qt, Breeze or Xorg bug. I am posting it here, because in my case it is reproducible only with breeze and oxygen theme, but not with fusion. Maybe, additional factors like video drivers are also important. I created an example, that illustrates the bug: There is a QWidgetAction based on QLineEdit, that is added to QMenu. There is a function, that deletes old QMenu instance and creates a new one, but QWidgetAction is moved to new parent with removeAction/addAction functions. Everything works fine so far. But next two lines of code added simultaneously, break widget drawing. We set background for the root QMenu, and added a child QMenu: mMenu->setStyleSheet("QMenu { background: rgba(240, 0, 0, 100%); }"); QMenu *submenu = new QMenu(mMenu); Hmm...?))) Reproducible: Always Steps to Reproduce: 1. go to https://github.com/technic/qt5-bug and build the project 2. run it and wait for 3sec (glitch creation is managed by timers) Actual Results: A transparent space instead of QLineEdit (see screenshot) Expected Results: QLineEdit popup: https://github.com/technic/qt5-bug/blob/master/ok.png Only breeze and oxygen themes are affected. Fusion theme works fine. Qt 5.7.0, radeon opensource driver.
Screenshot with a glitch https://github.com/technic/qt5-bug/blob/master/bug.png
In console I see QXcbConnection: XCB error: 8 (BadMatch)
I can confirm the issue by running the aforementioned project. Running with Fusion theme works fine but with Breeze the line edit disappears.
Hello, thanks for reporting. I'm investigating. I suspect this has to do with setting Qt::WA_TranslucentBackground to QMenu (line 326 of breezestyle.cpp), in order to have round corners. Will keep you posted. (in the meanwhile if someone can try disable that setting and try see if the bug is still present, that would help) Best, Hugo
Hello again, I can reproduce. so indeed this is some sort of conflict between setting a stylesheet, and setting the WA_TranslucentBackground flag. So really, something fishy with Qt. Now, I do not want to remove the flag as set from the style (that would make all the menus boring square, in breeze and oxygen). However, I found to possible fixes, on the application side (the qt-bug). Fix 1: call mMenu->ensurePolished() before setting the stylesheet. For some reason, setting the TranslucentBackground flag before setting the stylesheet fixes it (likely because the stylesheet disables again the flag). Fix 2: rather than using a stylesheed for just changing the background color, use native Qt API and change the QPalette: auto palette = mMenu->palette(); palette.setColor( QPalette::Background, qRgb( 240, 0, 0 ) ); mMenu->setPalette( palette ); Here, both changes fix the issue. Any chance you can push that upstream ? Best regards, Hugo
Note that among the two fixes, the second is prefered: it keeps the menu corners round. The first one gets you a square menu (by effectively disabling the style's rounding feature, by calling setStylesheet after polishing)
Thank you for the investigation. I remember that I have encountered similar wired behavior with WA_TranslucentBackground in the lxqt-panel. I think it is possible to push a workaround to LXQt project. Should we inform Qt developers about this thing?
Is this still relevant/reproducible?
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!