qt03 QString和QByteArray相互转换

  1. QString str("hello");
  2.  
    QByteArray bytes = str.toUtf8(); // QString转QByteArray方法1
  3.  
     
  4.  
    QString str("hello");
  5.  
    QByteArray bytes = str.toLatin1();
     
     
    1. QByteArray bytes("hello world");
    2.  
      QString string = bytes; // QByteArray转QString方法1 
    3.  
    4.  
      QByteArray bytes("hello world");
    5.  
      QString string;
    6.  
      string.prepend(bytes);// QByteArray转QString方法
原文地址:https://www.cnblogs.com/xpylovely/p/10901514.html