Changeset View
Changeset View
Standalone View
Standalone View
canvasitem.h
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 47 | public: | |||
---|---|---|---|---|---|
60 | ///Returns a Config that can be used to configure this item by the user. The default implementation returns one that says 'No configuration options'. | 60 | ///Returns a Config that can be used to configure this item by the user. The default implementation returns one that says 'No configuration options'. | ||
61 | virtual Config *config(QWidget *parent) { return new DefaultConfig(parent); } | 61 | virtual Config *config(QWidget *parent) { return new DefaultConfig(parent); } | ||
62 | ///Returns other items that should be movable (besides this one of course). | 62 | ///Returns other items that should be movable (besides this one of course). | ||
63 | virtual QList<QGraphicsItem *> moveableItems() const { return QList<QGraphicsItem *>(); } | 63 | virtual QList<QGraphicsItem *> moveableItems() const { return QList<QGraphicsItem *>(); } | ||
64 | 64 | | |||
65 | void setId(int newId) { m_id = newId; } | 65 | void setId(int newId) { m_id = newId; } | ||
66 | int curId() const { return m_id; } | 66 | int curId() const { return m_id; } | ||
67 | 67 | | |||
68 | ///Play a sound (e.g. playSound("wall") plays kdedir/share/apps/kolf/sounds/wall.wav). Optionally, specify \a vol to be between 0-1, for no sound to full volume, respectively. | | |||
69 | void playSound(const QString &file, double vol = 1); | | |||
70 | | ||||
71 | ///Called on ball's collision. Return if terrain collidingItems should be processed. | 68 | ///Called on ball's collision. Return if terrain collidingItems should be processed. | ||
72 | virtual bool collision(Ball *ball) { Q_UNUSED(ball) return false; } | 69 | virtual bool collision(Ball *ball) { Q_UNUSED(ball) return false; } | ||
73 | 70 | | |||
74 | ///Reimplement if you want extra items to have access to the game object. playSound() relies on having this. | 71 | ///Reimplement if you want extra items to have access to the game object. | ||
75 | virtual void setGame(KolfGame *game) { this->game = game; } | 72 | virtual void setGame(KolfGame *game) { this->game = game; } | ||
76 | 73 | | |||
77 | QString name() const { return m_name; } | 74 | QString name() const { return m_name; } | ||
78 | void setName(const QString &newname) { m_name = newname; } | 75 | void setName(const QString &newname) { m_name = newname; } | ||
79 | virtual void setSize(const QSizeF&) {} | 76 | virtual void setSize(const QSizeF&) {} | ||
80 | 77 | | |||
81 | virtual void moveBy(double dx, double dy); | 78 | virtual void moveBy(double dx, double dy); | ||
82 | 79 | | |||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |