之前多次出现这个问题,后来解决之后再出现就忘了怎么弄了,这次记录一下。

我这几次出现这种错误都是因为在Qt中将QString转const char* 时出现的。我的做法是有一个函数ToString()转为std::string

1 std::string MyProcessObject::ToString(QString strRaw)
2 {
3     return std::string((const char *)strRaw.toLocal8Bit());
4 }
ToString()

相关文章:

  • 2021-11-17
  • 2021-12-25
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
猜你喜欢
  • 2021-12-25
  • 2022-12-23
  • 2021-07-12
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案