QLabel* label = new QLabel("Hello World!"); QFont font("Arial", 20, QFont::Bold); label->setFont(font);
QLabel* label = new QLabel("Hello World!"); QFont font = label->font(); qDebug() << font.family() << font.pointSize() << font.weight();In this example, we create a new QLabel with text "Hello World!". We get the font properties of the label using font() function and store it in a QFont object font. We then print the font family, size, and weight using qDebug() function. Package Library: QFont is a class in Qt library.