mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Merge c3d6bdcbe7 into b1fe4c85d3
This commit is contained in:
commit
a94db13601
2 changed files with 23 additions and 0 deletions
|
|
@ -121,6 +121,13 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
|||
|
||||
extraHeight = vbox->sizeHint(Qt::PreferredSize).height();
|
||||
|
||||
QGraphicsProxyWidget *cardLocationLabelProxy = new QGraphicsProxyWidget;
|
||||
cardLocationLabelProxy->setWidget(&cardLocationLabel);
|
||||
if (!_isReversed && showLibraryLabel(_origZone, numberCards)) {
|
||||
cardLocationLabel.setText(tr("Top of Library"));
|
||||
vbox->addItem(cardLocationLabelProxy);
|
||||
}
|
||||
|
||||
QGraphicsLinearLayout *zoneHBox = new QGraphicsLinearLayout(Qt::Horizontal);
|
||||
|
||||
zoneContainer = new QGraphicsWidget(this);
|
||||
|
|
@ -139,6 +146,11 @@ ZoneViewWidget::ZoneViewWidget(Player *_player,
|
|||
|
||||
vbox->addItem(zoneHBox);
|
||||
|
||||
if (_isReversed && showLibraryLabel(_origZone, numberCards)) {
|
||||
cardLocationLabel.setText(tr("Bottom of Library"));
|
||||
vbox->addItem(cardLocationLabelProxy);
|
||||
}
|
||||
|
||||
zone = new ZoneViewZone(new ZoneViewZoneLogic(player, _origZone, numberCards, _revealZone, _writeableRevealZone,
|
||||
_isReversed, zoneContainer),
|
||||
zoneContainer);
|
||||
|
|
@ -575,3 +587,11 @@ void ZoneViewWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|||
expandWindow();
|
||||
}
|
||||
}
|
||||
|
||||
bool ZoneViewWidget::showLibraryLabel(CardZoneLogic *zone, int numberOfCards)
|
||||
{
|
||||
if (zone == nullptr || numberOfCards < 0) {
|
||||
return false;
|
||||
}
|
||||
return zone->getName() == ZoneNames::DECK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QGraphicsWidget>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPointer>
|
||||
#include <libcockatrice/utility/macros.h>
|
||||
|
|
@ -62,6 +63,7 @@ private:
|
|||
QComboBox sortBySelector;
|
||||
QCheckBox shuffleCheckBox;
|
||||
QCheckBox pileViewCheckBox;
|
||||
QLabel cardLocationLabel;
|
||||
|
||||
bool canBeShuffled;
|
||||
int extraHeight;
|
||||
|
|
@ -74,6 +76,7 @@ private:
|
|||
|
||||
void stopWindowDrag();
|
||||
void startWindowDrag(QGraphicsSceneMouseEvent *event);
|
||||
bool showLibraryLabel(CardZoneLogic *zone, int numberOfCards);
|
||||
QRectF closeButtonRect(QWidget *styleWidget) const;
|
||||
/**
|
||||
* @brief Resolves the QGraphicsView to use for drag coordinate mapping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue