QString 类型转换

构造函数:

QString()                                      //无参构造函数
QString(const QChar *unicode, int size = -1)   //QChar类型多个数转换成QString
QString(QChar ch)                              //一个QChar类型转化成QString
QString(int size, QChar ch)		       //
QString(QLatin1String str)
QString(const QString &other)
QString(QString &&other)
QString(const char *str)
QString(const QByteArray &ba)
		       //
QString(QLatin1String str)
QString(const QString &other)
QString(QString &&other)
QString(const char *str)
QString(const QByteArray &ba)
长度:
int size() const
转化类型:
 
CFStringRef toCFString() const QString toCaseFolded() const double toDouble(bool *ok = Q_NULLPTR) const float toFloat(bool *ok = Q_NULLPTR) const QString toHtmlEscaped() const int toInt(bool *ok = Q_NULLPTR, int base = 10) const QByteArray toLatin1() const QByteArray toLocal8Bit() const long toLong(bool *ok = Q_NULLPTR, int base = 10) const qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const QString toLower() const NSString *toNSString() const short toShort(bool *ok = Q_NULLPTR, int base = 10) const std::string toStdString() const std::u16string toStdU16String() const std::u32string toStdU32String() const std::wstring toStdWString() const uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const QVector toUcs4() const QString toUpper() const QByteArray toUtf8() const
Static Public Members

QString number(long n, int base = 10)
QString number(uint n, int base = 10)
QString number(int n, int base = 10)
QString number(ulong n, int base = 10)
QString number(qlonglong n, int base = 10)
QString number(qulonglong n, int base = 10)
QString number(double n, char format = 'g', int precision = 6)
QString vasprintf(const char *cformat, va_list ap)

QString::(double,'.',2);//保留double 小数点后两位


 
 
 
 
 

你可能感兴趣的:(QT5)