How to change string into QString?

前端 未结 7 715
一向
一向 2020-11-28 03:36

What is the most basic way to do it?

7条回答
  •  遥遥无期
    2020-11-28 04:26

    If compiled with STL compatibility, QString has a static method to convert a std::string to a QString:

    std::string str = "abc";
    QString qstr = QString::fromStdString(str);
    

提交回复
热议问题