QT 中按键响应问题,我的.h文件代码如下:
#ifndef Y1_H
#define Y1_H
#include "ui_y1.h"
#include "ui_y2.h"
class myclass1 : public QWidget, public Ui_widget
{
Q_OBJECT
public:
QWidget *w1;
Ui_widget2 *u2;
public:
myclass1(QWidget *parent=0);
public slots:
void slot3();
protected:
void KeyPressEvent(QKeyEvent *event);
};
#endif // Y1_H
.cpp文件代码如下:
void myclass1 :: KeyPressEvent(QKeyEvent *event)
{
if((event->key()) == (Qt::Key_E))
{ excs++;
if(excs%2 != 0)
{ myclass1::w1->show();
}
else
{ myclass1::w1->hide();
}
}
}
请高手给指教,为什麽make老编译过不去?提示 if((event->key()) == (Qt::Key_E))不对?
我用的是 :QT4.4.3, Linux环境下