Details
-
Bug
-
Resolution: Won't Do
-
P5: Not important
-
None
-
5.15.2, 5.15.5, 5.15.6, 5.15.8, 5.15.9, 5.15.10, 5.15.11, 6.2.0
Description
Ever since I upgraded an application to Qt5 I have seen bad rendering on some user environments, where the fill with Qt::transparent combined with the QT_XCB_NATIVE_PAINTING set to 1. seems to behave badly and not do proper antialising.
Take this sample code which is supposed to just open a window with a Hello printed:
#include <QtCore/QString> #include <QtGui/QColor> #include <QtGui/QPainter> #include <QtGui/QPixmap> #include <QtGui/QTextDocument> #include <QtWidgets/QApplication> #include <QtWidgets/QLabel> #include <QtWidgets/QMainWindow> #include <QtWidgets/QWidget> QPixmap getPixmap() { QTextDocument text; text.setPlainText("Hello"); QPixmap pm(100, 100); pm.fill(Qt::transparent); QPainter painter(&pm); text.drawContents(&painter, pm.rect()); return pm; } int main(int argc, char** argv) { QApplication app(argc, argv); QMainWindow mw; QLabel dummyLabel; QFont f = dummyLabel.font(); f.setStyleStrategy(QFont::NoSubpixelAntialias); dummyLabel.setFont(f); dummyLabel.setPixmap(getPixmap()); mw.setCentralWidget(&dummyLabel); mw.show(); return app.exec(); }
Here's how it looks on a RHEL8 machine without QT_XCB_NATIVE_PAINTING set:
Here's how it looks on some RHEL8 machine with QT_XCB_NATIVE_PAINTING set to 1:
I did debug, but couldn't get to the conclusion of what is to blame. Some of what I investigated:
- SSHing into a VM where an user reports the issue ("buggy" VM) does not reproduce it, only when running directly from the VM
- SSHing into a non-buggy machine from the "buggy" VM does not reproduce the issue
- This did not happen on Qt 4.6 (I know QT_XCB_NATIVE_PAINTING didn't exist back then, but then it was also the default)
- Users that get this bug can reproduce it from their VMs in RHEL8/RHEL7/CentOS7 etc, seems to be tied to how the display is setup or something they might have installed