Hello,
I'm pretty new to Qt and wanted to make a small puzzle game.
So I tried to use the KeyPressEvent() function to receive the keyboard input,
but if I try to use some memberfunctions or variables of my game class inside the KeyPressEvent() function it doesn't work.
It's written in Visual Studio.
I hope that someone can tell me where I messed up.
Here is a section of my programmtext:
#include "game.h"
#include "ui_game.h"
game::game(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
scene = new QGraphicsScene(this);
ui.graphicsView->setScene(scene);
fDraw(boxPos);
}
int game::fPosCalc(int counter)
{...}
void game::fDraw(int field[3][3])
{...}
void QWidget::keyPressEvent(QKeyEvent *w)
{
game.boxPos[3][3] = 1;
game.fDraw(boxPos)
}
Bookmarks