Summary of common QT classes

Source: Internet
Author: User
Tags printable characters

Reprint: http://www.verydemo.com/demo_c278_i1869.html

Programming with QT must have a certain understanding of the classes commonly used in QT. These classes can be divided into two types: one that is not derived from the QObject class, and is used to represent a variety of basic data objects, such as strings, images, fonts, and so on, where they are collectively referred to as basic classes; the other is derived from the Qwidget class, which represents a top-level window or widget This is collectively referred to as the window class.

The basic classes introduced here include Qchar, QString, Qpoint, Qsize, Qrect, Qfont, Qpixmap, Qlcon.

The window classes described here include Qwidget,qdialog,qlabel,qabstratacbutton,qpushbutton, Qcheckbox,qradiobutton,qlineedit

Qchar

The Qchar class is a class used in Qt to represent a character, implemented in a Qtcore shared library. The Qchar class uses a 2-byte Unicode encoding to represent one character.

Structure

The Qchar class provides constructors for several different prototypes for ease of use, such as:

[Plain] view plaincopyprint? Qchar ();                    //  constructs a null character, that is, ' Qchar '   ;        (char ch)   //  by character Data ch Construction    Qchar (uchar ch);           by unsigned character data ch construction    Qchar (ushort code);   //  by unsigned short shaping data code, Code is Unicode encoding    Qchar (short code);      //is constructed by   short shaping data code, Code is a Unicode encoding    Qchar (Uint code);      //  is constructed from unsigned integer data code, Code is a Unicode encoding    Qchar (Int code);       //  is constructed from integer data code, Code is Unicode encoding    view text print Qchar ();                    //  constructs a null character, that is, ' Qchar '   ;  (char ch)         //  by character Data ch Construction    Qchar (uchar ch);         //  by unsigned character data ch construction    Qchar (ushort code);    //   is constructed from unsigned short shaping data code, which is Unicode encoding    Qchar (Short code);      //by   Short shaping data code constructs, code is Unicode encoding    Qchar (uint code);      //  Constructed from unsigned integer data code, code is Unicode encoding    Qchar (int code);        //   is constructed from integer data code, code is Unicode encoding    view text print Qchar ();                    //  constructs a null character, that is, ' Qchar '    a char  ch);         //  by character Data ch Construction    Qchar (uchar  CH);        //  by unsigned character data ch construction    Qchar (Ushort code);    //&nbSP; constructed from unsigned short shaping data Code, code is Unicode encoding    Qchar (Short code);      //by   Short shaping data code constructs, code is Unicode encoding    Qchar (uint code);      //  Constructed from unsigned integer data code, code is Unicode encoding    Qchar (int code);        //   is constructed from integer data code, which is Unicode encoding   

Instead of directly constructing the objects of the Qchar class in actual use, these constructors are used as type conversions, allowing the compiler to automatically construct the required Qchar class objects. That is, you can safely use various integer types where you need to Qchar classes as arguments.

Judge

The Qchar class provides a number of member functions that can be used to determine the type of character, such as:[Plain] view plaincopyprint? Bool isdigit ()  const;            //   Determine if decimal digits (' 0 '  -  ' 9 ')    Bool isletter ()  const;           //  judge whether the letter    Bool isnumber ()  const;         //  judge whether it is a number, including sign, decimal point, etc.    bool isletterornumber ();     //  determine if the letter or number    Bool islower ()  const;            //  judge whether it is lowercase letter    bool isupper ()  const;            //  determine if the capital letter    Bool isnull ()   const;              //  judge whether it is a "    Bool isprint ()  const;            //  to determine if printable characters    bool isspace ()  const;          //  determine if it is a separator, including spaces, etc.    view text print bool isdigit ()  const;             //  judge whether it is a decimal digit (' 0 '  -  ' 9 ')    bool  isletter ()  const;          //  determine if the letter     Bool isnumber ()  const;&

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.