Change font in Qt application
Contents |
Overview
This code example shows how to change font of application an in Qt. This is done by setting the desired font QFont using QApplication::setFont().
This snippet can be self-signed.
Preconditions
- Install Qt SDK
Headers required
#include <QFont>Source
//specify a new font.
QFont newFont("Courier", 8, QFont::Bold, true);
//set font of application
QApplication::setFont(newFont);
Postconditions
The code snippet is expected to show font "Courier" on application.
Font Courier (Bold and Italic)
After changing font to Times
External links
Internal Links
Code Example
- 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.

