【问题标题】:Object back from pointer从指针返回的对象
【发布时间】:2011-04-27 19:10:53
【问题描述】:
void show(QString *s){
   //Here I want to show the value of the QString.
}

我该怎么做??

如果你能帮助我,我会很高兴。

【问题讨论】:

  • “显示值”是什么意思 - 弹出一个对话框?转换为char*?还有什么?
  • 您只是在问如何取消引用指针吗?在这种情况下,请使用 -> 运算符(假设这是 C++) - 请参阅下面的答案。

标签: pointers object qstring


【解决方案1】:

不确定您要问的是什么 - 请参阅我的 cmets。

也许这会有所帮助?

查看toAscii()toLatin1()toUtf8()

const char* data = s->toAscii();  // if you want ASCII encoding
data = s->toUtf8();  // if you want UTF-8 encoding

// etc.

【讨论】:

  • 啊,现在我明白了,我尝试了类似 std::cout
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-08-16
  • 2020-05-15
  • 1970-01-01
  • 2017-12-26
  • 1970-01-01
  • 1970-01-01
  • 2022-11-07
相关资源
最近更新 更多