Search code examples
qtantialiasingqlabel

How to enable anti-aliasing on Qlabel?


My QLabels look quite ugly, it seems that there's no anti-aliasing. How can I enable this feature (assuming it's available)?


Solution

  • QLabel * l = new QLabel();
    QFont f=l->font();
    f.setStyleStrategy(QFont::PreferAntialias);
    l->setFont(f);
    

    you may also alter application font settings, to be applied to all widgets you use...

    QFont f=QApplication::font();
    f.setStyleStrategy(QFont::PreferAntialias);
    QApplication::setFont(f);