mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
* feat(game): add drag selection counter overlay Display count of selected cards inside the lasso during drag selection. Count appears near cursor, repositioning to stay within selection bounds. Includes SelectionRubberBand subclass to allow label to appear above band. QRubberBand calls raise() in showEvent/changeEvent to stay on top - this subclass suppresses that behavior so dragCountLabel can be visible. Adds user setting to enable/disable the drag count overlay. * feat(game): add persistent selection counter overlay. Display total count of selected cards in bottom-right corner when multiple cards are selected. Updates on selection changes and window resize. The counter connects to QGraphicsScene::selectionChanged to stay up-to-date without requiring manual refresh. Adds user setting to enable/disable the total count overlay. --------- Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
41 lines
902 B
C++
41 lines
902 B
C++
/**
|
|
* @file game_view.h
|
|
* @ingroup GameGraphics
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef GAMEVIEW_H
|
|
#define GAMEVIEW_H
|
|
|
|
#include <QGraphicsView>
|
|
|
|
class GameScene;
|
|
class QLabel;
|
|
class QRubberBand;
|
|
|
|
class GameView : public QGraphicsView
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QAction *aCloseMostRecentZoneView;
|
|
QRubberBand *rubberBand;
|
|
QLabel *dragCountLabel;
|
|
QLabel *totalCountLabel;
|
|
QPointF selectionOrigin;
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
private slots:
|
|
void startRubberBand(const QPointF &selectionOrigin);
|
|
void resizeRubberBand(const QPointF &cursorPoint, int selectedCount);
|
|
void stopRubberBand();
|
|
void refreshShortcuts();
|
|
void updateTotalSelectionCount(const QSize &viewSize = QSize());
|
|
public slots:
|
|
void updateSceneRect(const QRectF &rect);
|
|
|
|
public:
|
|
explicit GameView(GameScene *scene, QWidget *parent = nullptr);
|
|
};
|
|
|
|
#endif
|