add function to sort hand by type and name

This commit is contained in:
Paul Carroll 2025-07-30 16:47:24 -04:00
parent 8ea4490441
commit eb3ae97ac1
2 changed files with 10 additions and 0 deletions

View file

@ -127,6 +127,15 @@ void HandZone::reorganizeCards()
update(); update();
} }
void HandZone::sortHand()
{
if (cards.isEmpty()) {
return;
}
cards.sortBy({CardList::SortByType, CardList::SortByName});
reorganizeCards();
}
void HandZone::setWidth(qreal _width) void HandZone::setWidth(qreal _width)
{ {
if (SettingsCache::instance().getHorizontalHand()) { if (SettingsCache::instance().getHorizontalHand()) {

View file

@ -19,6 +19,7 @@ public:
QRectF boundingRect() const override; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards() override; void reorganizeCards() override;
void sortHand();
void setWidth(qreal _width); void setWidth(qreal _width);
protected: protected: