This commit is contained in:
scotland0208 2026-04-25 10:01:48 -03:00 committed by GitHub
commit a94db13601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -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;
}

View file

@ -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