Change font in Qt application
hamishwillee
(Talk | contribs) m (Hamishwillee - Addition to article of: Category:MeeGo Category:Symbian. (Add platform categories)) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot update - Fix ArticleMetaData and other general fixes) |
||
| Line 1: | Line 1: | ||
[[Category:Qt]][[Category:UI]][[Category:Code Examples]] | [[Category:Qt]][[Category:UI]][[Category:Code Examples]] | ||
| − | {{ArticleMetaData <!-- v1. | + | {{ArticleMetaData <!-- v1.2 --> |
|sourcecode= [[Media:QtChangeFont.zip]] | |sourcecode= [[Media:QtChangeFont.zip]] | ||
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| Line 10: | Line 10: | ||
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 --> | |dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 --> | ||
|signing= Self-Signed | |signing= Self-Signed | ||
| − | |capabilities= <!-- Capabilities required (e.g. Location, NetworkServices. | + | |capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> |
|keywords= Font | |keywords= Font | ||
| − | |||
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | |language= <!-- Language category code for non-English topics - e.g. Lang-Chinese --> | ||
|translated-by= <!-- [[User:XXXX]] --> | |translated-by= <!-- [[User:XXXX]] --> | ||
| Line 37: | Line 36: | ||
<code cpp> | <code cpp> | ||
| − | //specify a | + | //specify a new font. |
QFont newFont("Courier", 8, QFont::Bold, true); | QFont newFont("Courier", 8, QFont::Bold, true); | ||
//set font of application | //set font of application | ||
| Line 48: | Line 47: | ||
'''Font Courier (Bold and Italic)''' | '''Font Courier (Bold and Italic)''' | ||
<br><br> | <br><br> | ||
| − | [[ | + | [[File:Font1.JPG]] |
<br><br> | <br><br> | ||
'''After changing font to Times''' | '''After changing font to Times''' | ||
<br> | <br> | ||
| − | [[ | + | [[File:Font2.JPG]] |
| Line 59: | Line 58: | ||
==Internal Links== | ==Internal Links== | ||
| − | * [[ | + | * [[How to use QFontComboBox]] |
==Code Example== | ==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.[[Category:MeeGo]] [[Category:Symbian]] | * [[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.[[Category:MeeGo]] [[Category:Symbian]] | ||
Revision as of 09:17, 20 February 2012
Article Metadata
Code Example
Source file: Media:QtChangeFont.zip
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
(20 Feb 2012)
Contents |
Overview
This code example shows how to change font of a Qt application. This is done by setting the desired font QFont using QApplication::setFont().
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.

