fixed multi-card dragging

This commit is contained in:
Max-Wilhelm Bruker 2009-09-09 16:46:09 +02:00
parent aa9ebd3179
commit 5fa009714b
3 changed files with 23 additions and 18 deletions

View file

@ -7,9 +7,10 @@
CardDragItem::CardDragItem(CardItem *_item, int _id, const QPointF &_hotSpot, bool _faceDown, CardDragItem *parentDrag)
: QGraphicsItem(), id(_id), item(_item), hotSpot(_hotSpot), faceDown(_faceDown), currentZone(0)
{
if (parentDrag)
if (parentDrag) {
parentDrag->addChildDrag(this);
else {
setZValue(1000000000 + hotSpot.x() * 1000000 + hotSpot.y() * 1000 + 1000);
} else {
if ((hotSpot.x() < 0) || (hotSpot.y() < 0)) {
qDebug(QString("CardDragItem: coordinate overflow: x = %1, y = %2").arg(hotSpot.x()).arg(hotSpot.y()).toLatin1());
hotSpot = QPointF();
@ -18,11 +19,11 @@ CardDragItem::CardDragItem(CardItem *_item, int _id, const QPointF &_hotSpot, bo
hotSpot = QPointF(CARD_WIDTH, CARD_HEIGHT);
}
setCursor(Qt::ClosedHandCursor);
setZValue(1000000000);
}
if (item->getTapped())
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
setZValue(2000000000);
setCacheMode(DeviceCoordinateCache);
}