×
Namespaces

Variants
Actions
(Difference between revisions)

Change font in Qt application

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Add Qt C++ UI category)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(One intermediate revision by one user not shown)
Line 26: Line 26:
  
 
==Headers required==
 
==Headers required==
<code cpp>
+
<code cpp-qt>
 
#include <QFont>
 
#include <QFont>
 
</code>
 
</code>
Line 32: Line 32:
 
==Source==
 
==Source==
  
<code cpp>
+
<code cpp-qt>
 
//specify a new font.
 
//specify a new font.
 
QFont newFont("Courier", 8, QFont::Bold, true);
 
QFont newFont("Courier", 8, QFont::Bold, true);
Line 55: Line 55:
  
 
* [[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.
 +
<!-- Translation --> [[pt:Archived:Como modificar a fonte de aplicações, em Qt]]

Latest revision as of 04:13, 11 October 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 (11 Oct 2012)

Contents

[edit] Headers required

#include <QFont>

[edit] Source

//specify a new font.
QFont newFont("Courier", 8, QFont::Bold, true);
//set font of application
QApplication::setFont(newFont);

[edit] Postconditions

The code snippet is expected to show font "Courier" on application.

[edit] Further links

[edit] 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.
This page was last modified on 11 October 2012, at 04:13.
529 page views in the last 30 days.
×