【发布时间】:2013-04-02 11:33:21
【问题描述】:
我正在尝试使用函数中的数据,该函数在使用 Const Char* 的 Const 函数中返回 QString。问题基本上如下:
int myObject::listChildProcesses([...]) const {
// getProcessName called from : QString myObject::getProcessName() { [...] }
const char* name = getProcessName().toLocal8Bit();
[...]
}
返回:
passing 'const myObject' as 'this' argument of 'QString myObject::getProcessName()' discards qualifiers
所以...我认为这里有一个常量问题。但是,我确实需要在 listChildProcess 中保持我的常量。您是否知道我可以通过保留它来解决这个问题?
【问题讨论】: