You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Bullet: public QObject, public QGraphicsRectItem{
Q_OBJECT
public:
Bullet(QGraphicsItem * parent=0); // parent only in header
public slots:
void move();
};
class Enemy: public QObject, public QGraphicsRectItem{
Q_OBJECT
public:
Enemy(QGraphicsItem * parent=0); // parent in header like above
public slots:
void move();
};
i.e., why can't I just declare
Enemy::Enemy(): QObject(), QGraphicsRectItem(){ ...}[/code]`
similar to the Bullet file?
hi,
as tp tutorial6:
when do I have to add *parent as a class parameter and when not?
e.g., not:
.cpp
header:
but e.g., yes:
.cpp
header:
i.e., why can't I just declare
Enemy::Enemy(): QObject(), QGraphicsRectItem(){ ...}[/code]`
similar to the Bullet file?
(ref.: https://github.com/MeLikeyCode/QtGameTutorial/tree/master/tutorial6)
(edit,
BTW, in previous tutorials https://github.com/MeLikeyCode/QtGameTutorial/tree/master/tutorial1 ... https://github.com/MeLikeyCode/QtGameTutorial/tree/master/tutorial5 this "parents" thing has not been added at all for either class)
The text was updated successfully, but these errors were encountered: