Qt World Summit: Submit your Presentation

OSX 10.8.4 and artifacts with WA_TranslucentBackground & FramelessWindowHint

  • Prior to switching to QT5.1 I was getting artifacts on Windows. Since switching I'm getting artifacts on OSX :( I see lots of threads and bugs on this, but nothing that details the problems I'm currently seeing on OSX. In my app I have QWidget that is WA_TranslucentBackground & FramelessWindowHint. It hosts a QFrame with a nine-slice image with rounded corners and gradient to transparent at the edges. It looks terrible on Mac. But I'm reproducing (intermittently and with random severity) the artifacts with the simplified code below:

    #include <QApplication>
    #include <QtGui>
    #include <QGraphicsScene>
    #include <QGraphicsView>
    #include <QLabel>
    #include <QWidget>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QWidget* container = new QWidget();
    container->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::NoDropShadowWindowHint);
    container->setAttribute(Qt::WA_TranslucentBackground, true);
    QLabel* label = new QLabel("Artifacts around me", container);
    return a.exec(&#41;;


    Any suggestions for a workaround or QT patch?

  • Lifetime Qt Champion


    Did you check the "bug report system":http://bugreports.qt-project.org to see whether it's a known problem ?

    If not, you could consider creating a new report with this minimal example.

  • I successfully removed my artifacts via

    paintEvent(QPaintEvent *)
    QPainter painter(this); painter.setCompositionMode(QPainter::CompositionMode_Clear);


Log in to reply