Change font in Qt application
Jump to navigation
Jump to search
Headers required[edit | edit source]
- include <QFont>
Source[edit | edit source]
//specify a new font.
QFont newFont("Courier", 8, QFont::Bold, true);
//set font of application
QApplication::setFont(newFont);
Postconditions[edit | edit source]
The code snippet is expected to show font "Courier" on application.
- Font1.JPG
Font Courier (Bold and Italic)
- Font2.JPG
After changing font to Times
Further links[edit | edit source]
Code Example[edit | edit source]
- File:QtChangeFont.zip shows how you can change text from font Courier to font Times from the menu. The example is tested on Nokia 5800 XpressMusic.
pt:Archived:Como modificar a fonte de aplicações, em Qt