how can i increase font size of QLabel with help of Qwidget::setFont()?
Unsolved
General and Desktop
-
QWidget* MainWindowUI::GetSoftwareManual() { static QWidget *w = 0; if (w != 0) { return w; } //w = WDG(); w = new QWidget(); QLabel* lal; // set the horizontal layout into Software Manual Widge QHBoxLayout *lay = NO_SPACING(NO_MARGIN(new QHBoxLayout(w))); lay->addWidget(lal= new QLabel("hello")); QFont f = lal->font(); f.setPixelSize(20); f.setPointSize(20); f.setBold(true); lal->setFont(f); return w; }
output:
It make text bold but does not increase font size.
I wanted use Qwidget::setFont and QFont for increasing size of font.
If i will QTimer then it is increase font size correctly, but it is add flick.
QTimer::singleShot(1, [=]() { lal->setFont(f); });
what is right way to use increasing size of QLabel text ?
-
so what happens when you go the other direction and shrink the text?
-
@Kent-Dorfman said in how can i increase font size of QLabel with help of Qwidget::setFont()?:
when you go the other direction
do you mean change alignment? Left to Right?
-
no, decrese the font size and see if it works. then you'll know whether you can change font size at all. If it works then that should be a hint as to why you cannot increase the size.