Precautions for programming from Symbian C ++ to QT (2)-Descriptor and Unicode in QT

Source: Internet
Author: User

Speaking of Symbian development, we have to mention the depressing descriptor in Symbian. Symbian introduces a series of mechanisms to improve stability, and descriptors are also one of them. From tdesc to rbuf, from the 16-bit Unicode to the 8-bit UTF-8, the unclear relationship between the chaos not only makes the new Symbian headache, but also in the Symbian Master feel ashamed.

 

Compared with Symbian descriptors, QT can be a big comfort for character applications in UNICODE, UTF-8, and even other encoding formats. Generally, Unicode in QT and Rich Text processing are divided into two major parts. This article focuses on Unicode in QT.

 

Unicode in QT can be very simple. From a 16-bit qstring to an 8-bit qbytearray, complicated descriptor problems in Symbian can be solved. Of course, qbytearray can not only be used as the encoding of the UTF-8, Unicode, binary, ASCII can be. Unicode in QT also provides good support for C-style strings.

 

From Symbian to QT to C style, new contacts may face a large number of Apis but do not know how to call them. Here are some of the more common usage:

1. qstring to const char *: qstring: tolocal8bit (): constdata ()

2. A series of toxxx () APIs

3. qbytearray can be used for binary file reading or network data storage.

4. Const char * or qstring parameters will be used in some classes in QT. If you can choose one, it is best to use qstring, such as qpixmap

5. the descriptor operations in Symbian are also relatively complex. If you use QT, you only need to know the usage of Arg and append.

6. For internationalization, the qtextcodec class is frequently used.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.