我有以下代码:
class myslot
{
public:
Q_OBJECT
myslot()
{
}
~myslot()
{
}
typedef enum Emycars{volvo,benz,tata}cars;
public slots:
void hellowslot(myslot::cars);
};
void myslot::hellowslot(myslot::cars cars1)
{
}
class mysignal
{
public:
Q_OBJECT
public:
mysignal(myslot *ourslot)
{
bool val = QObject::connect(this,SIGNAL(hellowsignal(myslot::Emycars)),ourslot,SLOT(hellowslot(myslot::Emycars)));
}
~mysignal()
{
}
signals:
void hellowsignal(myslot::Emycars);
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
myslot slot;
mysignal sig(&slot);
// DeleteNow w;
// w.showMaximized();
return a.exec();
}
我的代码有什么错误?我为接收枚举的函数编写连接的方式是否正确?