Fix indentation (and Debug build) (#2418)
* Fix indentation (and Debug build) * More indentation fixes
This commit is contained in:
parent
24c95e00ed
commit
9ba3f21730
2 changed files with 59 additions and 50 deletions
|
@ -130,18 +130,19 @@ void ArrowItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(event->scenePos());
|
QList<QGraphicsItem *> colliding = scene()->items(event->scenePos());
|
||||||
for (int i = 0; i < colliding.size(); ++i)
|
for (int i = 0; i < colliding.size(); ++i) {
|
||||||
if (qgraphicsitem_cast<CardItem *>(colliding[i])) {
|
if (qgraphicsitem_cast<CardItem *>(colliding[i])) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
if (event->button() == Qt::RightButton) {
|
if (event->button() == Qt::RightButton) {
|
||||||
Command_DeleteArrow cmd;
|
Command_DeleteArrow cmd;
|
||||||
cmd.set_arrow_id(id);
|
cmd.set_arrow_id(id);
|
||||||
player->sendGameCommand(cmd);
|
player->sendGameCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color)
|
ArrowDragItem::ArrowDragItem(Player *_owner, ArrowTarget *_startItem, const QColor &_color)
|
||||||
|
@ -166,35 +167,39 @@ void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
||||||
ArrowTarget *cursorItem = 0;
|
ArrowTarget *cursorItem = 0;
|
||||||
qreal cursorItemZ = -1;
|
qreal cursorItemZ = -1;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--)
|
for (int i = colliding.size() - 1; i >= 0; i--) {
|
||||||
if (qgraphicsitem_cast<PlayerTarget *>(colliding.at(i)) || qgraphicsitem_cast<CardItem *>(colliding.at(i)))
|
if (qgraphicsitem_cast<PlayerTarget *>(colliding.at(i)) || qgraphicsitem_cast<CardItem *>(colliding.at(i))) {
|
||||||
if (colliding.at(i)->zValue() > cursorItemZ) {
|
if (colliding.at(i)->zValue() > cursorItemZ) {
|
||||||
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
||||||
cursorItemZ = cursorItem->zValue();
|
cursorItemZ = cursorItem->zValue();
|
||||||
}
|
}
|
||||||
if ((cursorItem != targetItem) && targetItem) {
|
}
|
||||||
targetItem->setBeingPointedAt(false);
|
}
|
||||||
targetItem->removeArrowTo(this);
|
|
||||||
}
|
|
||||||
if (!cursorItem) {
|
|
||||||
fullColor = false;
|
|
||||||
targetItem = 0;
|
|
||||||
updatePath(endPos);
|
|
||||||
} else {
|
|
||||||
if (cursorItem != targetItem) {
|
|
||||||
fullColor = true;
|
|
||||||
if (cursorItem != startItem) {
|
|
||||||
cursorItem->setBeingPointedAt(true);
|
|
||||||
cursorItem->addArrowTo(this);
|
|
||||||
}
|
|
||||||
targetItem = cursorItem;
|
|
||||||
}
|
|
||||||
updatePath();
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
|
|
||||||
for (int i = 0; i < childArrows.size(); ++i)
|
if ((cursorItem != targetItem) && targetItem) {
|
||||||
childArrows[i]->mouseMoveEvent(event);
|
targetItem->setBeingPointedAt(false);
|
||||||
|
targetItem->removeArrowTo(this);
|
||||||
|
}
|
||||||
|
if (!cursorItem) {
|
||||||
|
fullColor = false;
|
||||||
|
targetItem = 0;
|
||||||
|
updatePath(endPos);
|
||||||
|
} else {
|
||||||
|
if (cursorItem != targetItem) {
|
||||||
|
fullColor = true;
|
||||||
|
if (cursorItem != startItem) {
|
||||||
|
cursorItem->setBeingPointedAt(true);
|
||||||
|
cursorItem->addArrowTo(this);
|
||||||
|
}
|
||||||
|
targetItem = cursorItem;
|
||||||
|
}
|
||||||
|
updatePath();
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
|
||||||
|
for (int i = 0; i < childArrows.size(); ++i) {
|
||||||
|
childArrows[i]->mouseMoveEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
@ -257,27 +262,31 @@ void ArrowAttachItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
QList<QGraphicsItem *> colliding = scene()->items(endPos);
|
||||||
ArrowTarget *cursorItem = 0;
|
ArrowTarget *cursorItem = 0;
|
||||||
qreal cursorItemZ = -1;
|
qreal cursorItemZ = -1;
|
||||||
for (int i = colliding.size() - 1; i >= 0; i--)
|
for (int i = colliding.size() - 1; i >= 0; i--) {
|
||||||
if (qgraphicsitem_cast<CardItem *>(colliding.at(i)))
|
if (qgraphicsitem_cast<CardItem *>(colliding.at(i))) {
|
||||||
if (colliding.at(i)->zValue() > cursorItemZ) {
|
if (colliding.at(i)->zValue() > cursorItemZ) {
|
||||||
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
cursorItem = static_cast<ArrowTarget *>(colliding.at(i));
|
||||||
cursorItemZ = cursorItem->zValue();
|
cursorItemZ = cursorItem->zValue();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((cursorItem != targetItem) && targetItem)
|
if ((cursorItem != targetItem) && targetItem) {
|
||||||
targetItem->setBeingPointedAt(false);
|
targetItem->setBeingPointedAt(false);
|
||||||
if (!cursorItem) {
|
}
|
||||||
fullColor = false;
|
if (!cursorItem) {
|
||||||
targetItem = 0;
|
fullColor = false;
|
||||||
updatePath(endPos);
|
targetItem = 0;
|
||||||
} else {
|
updatePath(endPos);
|
||||||
fullColor = true;
|
} else {
|
||||||
if (cursorItem != startItem)
|
fullColor = true;
|
||||||
cursorItem->setBeingPointedAt(true);
|
if (cursorItem != startItem) {
|
||||||
targetItem = cursorItem;
|
cursorItem->setBeingPointedAt(true);
|
||||||
updatePath();
|
}
|
||||||
}
|
targetItem = cursorItem;
|
||||||
update();
|
updatePath();
|
||||||
|
}
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * /*event*/)
|
void ArrowAttachItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * /*event*/)
|
||||||
|
|
|
@ -79,7 +79,7 @@ QVariant DeckListModel::data(const QModelIndex &index, int role) const
|
||||||
// debugIndexInfo("data", index);
|
// debugIndexInfo("data", index);
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
if (index.column() >= columnCount())
|
if (index.column() >= columnCount())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
AbstractDecklistNode *temp = static_cast<AbstractDecklistNode *>(index.internalPointer());
|
AbstractDecklistNode *temp = static_cast<AbstractDecklistNode *>(index.internalPointer());
|
||||||
|
@ -136,7 +136,7 @@ QVariant DeckListModel::headerData(int section, Qt::Orientation orientation, int
|
||||||
{
|
{
|
||||||
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal))
|
if ((role != Qt::DisplayRole) || (orientation != Qt::Horizontal))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
if (section >= columnCount())
|
if (section >= columnCount())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 0: return tr("Number");
|
case 0: return tr("Number");
|
||||||
|
@ -310,7 +310,7 @@ void DeckListModel::sortHelper(InnerDecklistNode *node, Qt::SortOrder order)
|
||||||
// Sort children of node and save the information needed to
|
// Sort children of node and save the information needed to
|
||||||
// update the list of persistent indexes.
|
// update the list of persistent indexes.
|
||||||
QVector<QPair<int, int> > sortResult = node->sort(order);
|
QVector<QPair<int, int> > sortResult = node->sort(order);
|
||||||
|
|
||||||
QModelIndexList from, to;
|
QModelIndexList from, to;
|
||||||
int columns = columnCount();
|
int columns = columnCount();
|
||||||
for (int i = sortResult.size() - 1; i >= 0; --i) {
|
for (int i = sortResult.size() - 1; i >= 0; --i) {
|
||||||
|
|
Loading…
Reference in a new issue