Changeset View
Changeset View
Standalone View
Standalone View
src/gameitem.cpp
Context not available. | |||||
71 | 71 | | |||
---|---|---|---|---|---|
72 | bool GameItem::isShadow(QPointF const position) const | 72 | bool GameItem::isShadow(QPointF const position) const | ||
73 | { | 73 | { | ||
74 | // Get the realated point. | 74 | int newPosX = position.x() + getShadowDeltaX(); | ||
75 | QPointF mappedPosition = mapFromParent(position); | 75 | int newPosY = position.y() + getShadowDeltaY(); | ||
76 | 76 | | |||
77 | int newPosX = mappedPosition.x() + getShadowDeltaX(); | 77 | if ((newPosX < 0 || newPosX > m_selPix->width()) || | ||
78 | int newPosY = mappedPosition.y() + getShadowDeltaY(); | 78 | (newPosY < 0 || newPosY > m_selPix->height())) { | ||
79 | | ||||
80 | if ((newPosX < 0 || newPosX > m_selPix->width()) || (newPosY < 0 || newPosY > m_selPix->height())) { | | |||
81 | return true; | 79 | return true; | ||
82 | } | 80 | } | ||
83 | 81 | | |||
Context not available. | |||||
123 | void GameItem::paint(QPainter * pPainter, const QStyleOptionGraphicsItem *, QWidget *) | 121 | void GameItem::paint(QPainter * pPainter, const QStyleOptionGraphicsItem *, QWidget *) | ||
124 | { | 122 | { | ||
125 | if (isSelected()) { | 123 | if (isSelected()) { | ||
126 | pPainter->drawPixmap(pos(), *m_selPix); | 124 | pPainter->drawPixmap(QPointF(0.0, 0.0), *m_selPix); | ||
127 | pPainter->drawPixmap(pos() + m_faceOffset, *m_facePix); | 125 | pPainter->drawPixmap(QPointF(0.0, 0.0) + m_faceOffset, *m_facePix); | ||
128 | } else { | 126 | } else { | ||
129 | pPainter->drawPixmap(pos(), *m_unselPix); | 127 | pPainter->drawPixmap(QPointF(0.0, 0.0), *m_unselPix); | ||
130 | pPainter->drawPixmap(pos() + m_faceOffset, *m_facePix); | 128 | pPainter->drawPixmap(QPointF(0.0, 0.0) + m_faceOffset, *m_facePix); | ||
131 | } | 129 | } | ||
132 | } | 130 | } | ||
133 | 131 | | |||
Context not available. | |||||
172 | 170 | | |||
173 | QRectF GameItem::boundingRect() const | 171 | QRectF GameItem::boundingRect() const | ||
174 | { | 172 | { | ||
175 | return QRectF(pos(), m_selPix->size()); | 173 | return QRectF(QPointF(0.0, 0.0), m_selPix->size()); | ||
176 | } | 174 | } | ||
177 | 175 | | |||
178 | QRectF GameItem::rect() const | 176 | QRectF GameItem::rect() const | ||
Context not available. |