My QLabels look quite ugly, it seems that there's no anti-aliasing. How can I enable this feature (assuming it's available)?
How to enable anti-aliasing on Qlabel?
Asked Answered
This is a very wild guess since I don't have experience with Qt, but does setting a background color solve the problem ? Many UI systems don't do font anti-aliasing without a background since the aliased pixels depend on a background color to blend in to. –
Algar
You probably should tell what OS you are using. My QLabels look just fine. –
Sharl
Are you using Qt software rendering (raster) ? –
Phanerozoic
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);
Remember that iz is
QFont::PreferAntialias
. –
Morissa You can set the Antialisasing attribute in the label's font to PreferAntialias. You can do it in QtCreator or by code like this :
QFont f("Times", 50);
f.setStyleStrategy(QFont::PreferAntialias);
ui->label->setFont(f);
Hope this helps
© 2022 - 2024 — McMap. All rights reserved.