Namespaces
Variants
Actions
Revision as of 02:51, 26 October 2011 by hamishwillee (Talk | contribs)

Change font in Qt application

Jump to: navigation, search
{{{width}}}
21 Sep
2009
Article Metadata

Code Example
Tested with
Devices(s): Nokia 5800 XpressMusic

Compatibility
Platform(s): Symbian^1,Symbian^3, Meamo, MeeGo

Platform Security
Signing Required: Self-Signed

Article
Keywords: Font
Created: savaj (12 Jun 2009)
Last edited: hamishwillee (26 Oct 2011)

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.

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)

Font1.JPG

After changing font to Times
Font2.JPG


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.
892 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved