×
Namespaces

Variants
Actions
(Difference between revisions)

Change font in Qt application

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Improve wording)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix ArticleMetaData and RevieweApproval)
Line 1: Line 1:
 
[[Category:Qt]][[Category:UI]][[Category:Code Examples]]
 
[[Category:Qt]][[Category:UI]][[Category:Code Examples]]
{{ReviewerApproved|timestamp=20090921}}
+
 
{{ArticleMetaData
+
{{ArticleMetaData <!-- v1.1 -->
|platform=Symbian^1,Symbian^3, Meamo, MeeGo
+
|sourcecode= [[Media:QtChangeFont.zip]]
|devices=Nokia 5800 XpressMusic
+
|creationdate=20090612
+
|keywords=Font
+
|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]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Nokia 5800 XpressMusic
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=Self-Signed
+
|platform= Symbian^1,Symbian^3, Meamo, MeeGo
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Savaj]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= Self-Signed
 +
|capabilities= <!-- Capabilities required (e.g. Location, NetworkServices.) -->
 +
|keywords= Font
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090612
 +
|author= [[User:Savaj]]
 
}}
 
}}
  
Line 49: Line 59:
  
 
==Internal Links==
 
==Internal Links==
* [[How to use QFontComboBox]]
+
* [[How to use QFontComboBox in Qt|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.
 
* [[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.

Revision as of 07:15, 10 February 2012


Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): Symbian^1,Symbian^3, Meamo, MeeGo
Symbian
Platform Security
Signing Required: Self-Signed
Article
Keywords: Font
Created: savaj (12 Jun 2009)
Last edited: hamishwillee (10 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)

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.
526 page views in the last 30 days.
×