×
Namespaces

Variants
Actions
(Difference between revisions)

Change font in Qt application

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix ArticleMetaData and other general fixes)
hamishwillee (Talk | contribs)
m (Hamishwillee - Add Abstract. Tidy wiki text)
Line 1: Line 1:
[[Category:Qt]][[Category:UI]][[Category:Code Examples]]
+
[[Category:Qt]][[Category:UI]][[Category:Code Examples]][[Category:MeeGo]][[Category:Symbian]]
 +
{{Abstract|This code example shows how to change font of a Qt (C++) application. This is done by setting the desired font {{Qapiname|QFont}} using {{Qapiname|QApplication::setFont()}}.}}
  
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
Line 23: Line 24:
 
|author= [[User:Savaj]]
 
|author= [[User:Savaj]]
 
}}
 
}}
 
==Overview==
 
 
{{Abstract|This code example shows how to change font of a Qt application. This is done by setting the desired font {{Qapiname|QFont}} using {{Qapiname|QApplication::setFont()}}.}}
 
  
 
==Headers required==
 
==Headers required==
Line 44: Line 41:
 
==Postconditions==
 
==Postconditions==
  
The code snippet is expected to show font "Courier" on application.<br><br>
+
The code snippet is expected to show font "Courier" on application.
'''Font Courier (Bold and Italic)'''
+
<br><br>
+
[[File:Font1.JPG]]
+
<br><br>
+
'''After changing font to Times'''
+
<br>
+
[[File:Font2.JPG]]
+
  
 +
<gallery widths="300px" heights="400px">
 +
File:Font1.JPG|Font Courier (Bold and Italic)
 +
File:Font2.JPG|After changing font to Times
 +
</gallery>
  
==External links==
+
==Further links==
 
* [http://doc.qt.nokia.com/stable/qfont.html QFont]
 
* [http://doc.qt.nokia.com/stable/qfont.html QFont]
 
==Internal Links==
 
 
* [[How to use QFontComboBox]]
 
* [[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.

Revision as of 09:38, 20 February 2012

This code example shows how to change font of a Qt (C++) application. This is done by setting the desired font QFont using QApplication::setFont().

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 (20 Feb 2012)

Contents

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.

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

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×