Looks like your widget is not getting "focus". Override your mouse press event: void QSGameBoard::mousePressEvent ( QMouseEvent * event ){ printf("\nMouse in board"); setFocus(); } Here's the source code for a working example: QSGameBoard. H ifndef _QSGAMEBOARD_H #define _QSGAMEBOARD_H #include #include class QSGameBoard : public QWidget { Q_OBJECT public: QSGameBoard(QWidget *p, int w, int h, QGraphicsScene *s); signals: void keyCaught(QKeyEvent *e); protected: virtual void keyPressEvent(QKeyEvent *event); void mousePressEvent ( QMouseEvent * event ); }; #endif /* _QSGAMEBOARD_H QSGameBoard.
Cpp include #include #include #include #include "QSGameBoard. H" QSGameBoard::QSGameBoard(QWidget* p, int w, int h, QGraphicsScene* s) : QWidget(p){ QLabel* o = new QLabel(tr("Test Test Test")); QGridLayout* g = new QGridLayout(this); g->addWidget(o); } void QSGameBoard::keyPressEvent(QKeyEvent* event){ printf("\nkey event in board: %i", event->key()); } void QSGameBoard::mousePressEvent ( QMouseEvent * event ){ printf("\nMouse in board"); setFocus(); } main. Cpp include #include #include "QSGameBoard.
H" int main(int argc, char *argv) { // initialize resources, if needed // Q_INIT_RESOURCE(resfile); QApplication app(argc, argv); QMainWindow oM; QGraphicsScene o; QSGameBoard a(&oM, 1, 2, &o); oM. SetCentralWidget(&a); a.show(); oM.show(); // create and show your widgets here return app.exec(); }.
Looks like your widget is not getting "focus". Override your mouse press event: void QSGameBoard::mousePressEvent ( QMouseEvent * event ){ printf("\nMouse in board"); setFocus(); } Here's the source code for a working example: QSGameBoard. H #ifndef _QSGAMEBOARD_H #define _QSGAMEBOARD_H #include #include class QSGameBoard : public QWidget { Q_OBJECT public: QSGameBoard(QWidget *p, int w, int h, QGraphicsScene *s); signals: void keyCaught(QKeyEvent *e); protected: virtual void keyPressEvent(QKeyEvent *event); void mousePressEvent ( QMouseEvent * event ); }; #endif /* _QSGAMEBOARD_H */ QSGameBoard.
Cpp #include #include #include #include #include "QSGameBoard. H" QSGameBoard::QSGameBoard(QWidget* p, int w, int h, QGraphicsScene* s) : QWidget(p){ QLabel* o = new QLabel(tr("Test Test Test")); QGridLayout* g = new QGridLayout(this); g->addWidget(o); } void QSGameBoard::keyPressEvent(QKeyEvent* event){ printf("\nkey event in board: %i", event->key()); } void QSGameBoard::mousePressEvent ( QMouseEvent * event ){ printf("\nMouse in board"); setFocus(); } main. Cpp #include #include #include "QSGameBoard.
H" int main(int argc, char *argv) { // initialize resources, if needed // Q_INIT_RESOURCE(resfile); QApplication app(argc, argv); QMainWindow oM; QGraphicsScene o; QSGameBoard a(&oM, 1, 2, &o); oM. SetCentralWidget(&a); a.show(); oM.show(); // create and show your widgets here return app.exec(); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.