#includeint main() { QFont font("Times", 12); font.setBold(true); // set font to be bold return 0; }
#includeThis example sets the font for a QLabel widget to be bold for a font named "Arial" with a size of 10 points. Package library: This code uses the Qt library, specifically the QFont class.#include int main() { QLabel label("Hello, world!"); QFont font("Arial", 10); font.setBold(true); // set font to be bold label.setFont(font); label.show(); return 0; }