#include#include int main() { QFont font; qDebug() << "Default Font Family: " << font.defaultFamily(); return 0; }
#includeIn this example, we create a QLabel object and set the font family to Arial using the setFamily method of the QFont class. We then set the font for the label using the setFont method and display the label using the show method. The QFont class is part of the Qt Core module, which is included in the Qt library package.#include int main() { QFont font; font.setFamily("Arial"); QLabel label("Hello World!"); label.setFont(font); label.show(); return 0; }