【发布时间】:2014-11-25 19:12:48
【问题描述】:
我正在尝试检索密钥,然后将其传递给窗口类... 我坚持... 这是我的代码:
#include "mainwindow.h"
#include "game.h"
#include <QApplication>
#include <QKeyEvent>
#include <QString>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Game g(4);
MainWindow w;
w.doSomething();
while(QString text = keyPressEvent(QKeyEvent *e)->text()){ // this is not working
g.action(text);
w.update(g.getState());
}
w.show();
return a.exec();
}
我应该将 Game 类包装在 w 类中作为私有成员还是什么? 我试过...没有成功。
谢谢。
【问题讨论】: