×
Namespaces

Variants
Actions
(Difference between revisions)

Currency symbols in Qt

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan")
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetadata)
Line 1: Line 1:
 +
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|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= 20101231
 +
|author= [[User:Achipa]]
 +
}}
 
[[Category:Qt]]
 
[[Category:Qt]]
 
A fairly common case of using special characters are currency symbols. The general advice is that you should not include these symbols in your code, as then your editor, compiler, platform and target device have to align up. Usually the suggestion is to use the tr() translation mechanism, but for a simple task like currency symbol there is a simpler solution. Here is an example using an EUR sign in a QLabel:
 
A fairly common case of using special characters are currency symbols. The general advice is that you should not include these symbols in your code, as then your editor, compiler, platform and target device have to align up. Usually the suggestion is to use the tr() translation mechanism, but for a simple task like currency symbol there is a simpler solution. Here is an example using an EUR sign in a QLabel:

Revision as of 10:01, 20 July 2012

Article Metadata
Compatibility
Platform(s):
Symbian
Article
Created: achipa (31 Dec 2010)
Last edited: hamishwillee (20 Jul 2012)

A fairly common case of using special characters are currency symbols. The general advice is that you should not include these symbols in your code, as then your editor, compiler, platform and target device have to align up. Usually the suggestion is to use the tr() translation mechanism, but for a simple task like currency symbol there is a simpler solution. Here is an example using an EUR sign in a QLabel:

#define EUR QChar(8364)
#define GBP QChar(163)
#define JPY QChar(165)
 
QLabel label = new QLabel();
label->setText(QString("Currency is %1").arg(EUR));

This way the encoding of the source files is irrelevant, as Qt's QString will interpret the utf characters, not the editor or platform.

86 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.

×