class QTTEST : public QMainWindow
{
Q_OBJECT
public:
QTTEST(QWidget *parent = 0, Qt::WFlags flags = 0);
~QTTEST();
bool once;
void timerEvent(QTimerEvent* event);
void paintEvent(QPaintEvent* event) ;
void keyPressEvent(QKeyEvent* event);
void test();//响应此事件
Ui::QTTESTClass ui;
private:
};
QApplication a(argc, argv);
QTTEST* w=new QTTEST();
xtest* tttt=new xtest;
w->show();
QObject::connect(w->ui.pushButton,SIGNAL(clicked()),w,SLOT(test()));
return a.exec();
为什么我按下去一点反应都没??????????
------解决方案--------------------
.h里需要 标识slot
- C/C++ code
public slots:void test();