mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-10 04:07:25 -08:00
Drag from grave/rfg implemented
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "gravezone.h"
|
||||
#include "player.h"
|
||||
#include "client.h"
|
||||
#include "carddragitem.h"
|
||||
#include "zoneviewzone.h"
|
||||
|
||||
GraveZone::GraveZone(Player *_p, QGraphicsItem *parent)
|
||||
@@ -56,3 +57,36 @@ void GraveZone::reorganizeCards()
|
||||
{
|
||||
update(boundingRect());
|
||||
}
|
||||
|
||||
void GraveZone::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
CardZone::mousePressEvent(event);
|
||||
if (event->isAccepted())
|
||||
return;
|
||||
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
event->accept();
|
||||
} else
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void GraveZone::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if ((event->screenPos() - event->buttonDownScreenPos(Qt::LeftButton)).manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
|
||||
if (cards->empty())
|
||||
return;
|
||||
|
||||
CardItem *card = cards->at(0);
|
||||
CardDragItem *drag = card->createDragItem(this, card->getId(), event->pos(), event->scenePos());
|
||||
drag->grabMouse();
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
||||
void GraveZone::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user