c++ - Using getter with Qt Gui -


I am creating a game when a user presses an attack and the program returns the correct one. It works. But I wanted to make a waiter who gave the value of this boolean, and here's the break: This does not work when I am using the recipient by creating my controller:

  items = New item ();  getAttack ()) {/ code>  

When I press A, it does not return anything. Why?

This is my file CPP ( attack _ a private variable)

  zero items :: keyPressEvent (QKeyEvent * event) {switch (event- & Gt; Key ()) {Cases Qt :: Key_A: attack_ = true; break; } Invasion (); Updates(); } Zero object :: attack () {if (attack _) {qDebug ()  & Lt; "I want to kill you!" ; }} Bool Items :: getAttack () // does not work {return attack_; } Category Items: Public Elements, Public QGraphicsPixmapItem {Public: Items (): Elements (0,0) {attack_ = false; Invasion (); GetAttack (); SetFlag (QGraphicsItem :: ItemIsFocusable); }}  


Comments