Solved QFont - Text size.
-
How can I get the text size in pixels? I looked a bit at the QFont class.
For example, I make a QFont
pSmallThickFont=new QFont("Arial", 14, -1, false);
pSmallThickFont->setBold(true);and I make a QLabel
STATICInformation1=new QLabel(this);
STATICInformation1->setGeometry(xSPosition1, yPosition1, 250, 22);
STATICInformation1→setText(tr("Some text goes here"));
STATICInformation1->setFont(pSmallThickFont[0]);How many pixels would "Some text goes here" occupy?
Let’s forget about scaling on high DPI screens for the moment.
-
You can take a look at QFontMetrics