这是我的示例代码:
class hoho : public QObject
{
Q_OBJECT
public:
hoho()
{
httpFetch = new HttpFetch(QUrl("http://www.google.com/"));
connect(httpFetch, SIGNAL(Fetched()), this, SLOT(PrintData(QByteArray)));
}
void PrintData(QByteArray http)
{
qDebug()<<http;
}
HttpFetch *httpFetch;
};
当我尝试编译它时,会弹出以下错误
1>main.cpp(15): error C2243: 'type cast' : conversion from 'HttpFetch *' to 'const QObject *' exists, but is inaccessible
此错误来自类派生自QObject
(信号和槽机制所必需的)。
谁能告诉我如何解决这个问题?