1>d:\我的文档\visual studio 2005\projects\test_qdbus\test_qdbus\qdevicechangeevent.h(29) : error C2061: syntax error : identifier 'AAction'
1>d:\我的文档\visual studio 2005\projects\test_qdbus\test_qdbus\qdevicechangeevent.h(31) : error C2143: syntax error : missing ';' before 'public'
1>d:\我的文档\visual studio 2005\projects\test_qdbus\test_qdbus\qdevicechangeevent.h(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\我的文档\visual studio 2005\projects\test_qdbus\test_qdbus\qdevicechangeevent.h(31) : warning C4183: 'Q_ENUMS': missing return type; assumed to be a member function returning 'int'
我的QT是4.5.0版本的,在继承QEvent类时代码如下:
class Q_DLL_EXPORT QDeviceChangeEvent : public QEvent
{
Q_ENUMS(AAction)
public:
enum AAction { Add, Remove, Change};
//static const Type EventType; //VC link error
explicit QDeviceChangeEvent(AAction action, const QString& device);
AAction action() const {return m_action;}
QString device() const {return m_device;}
static Type registeredType()
{
static Type EventType = static_cast<Type>(registerEventType());
return EventType;
}
private:
AAction m_action;
QString m_device;
};
请问是因为QT版本的原因不认识Q_ENUMS吗?为什么会出现这种错误呢?谢谢大侠!