mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
One more doxy.
This commit is contained in:
parent
75c674e6bb
commit
47aaad275a
1 changed files with 41 additions and 6 deletions
|
|
@ -6,26 +6,61 @@
|
|||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
* @class ArchidektDeckPreviewImageDisplayWidget
|
||||
* @brief Widget for displaying a deck preview image with overlaid metadata labels.
|
||||
*
|
||||
* This widget shows a deck's preview image along with several overlay labels:
|
||||
* - Top-left: Deck name.
|
||||
* - Top-right: Card count.
|
||||
* - Bottom-left: EDH bracket (if applicable).
|
||||
* - Bottom-right: View count.
|
||||
*
|
||||
* Labels automatically scale and position themselves relative to the widget's size.
|
||||
* The image can be scaled while maintaining a specified aspect ratio.
|
||||
*
|
||||
* ### Features
|
||||
* - Adjustable preview width and aspect ratio.
|
||||
* - Labels automatically repositioned on resize.
|
||||
* - Supports overlaying multiple pieces of metadata with shadowed labels for readability.
|
||||
*/
|
||||
class ArchidektDeckPreviewImageDisplayWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs the deck preview display widget.
|
||||
* @param parent Optional parent widget.
|
||||
*/
|
||||
explicit ArchidektDeckPreviewImageDisplayWidget(QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Sets the aspect ratio for the preview image (height / width).
|
||||
* @param ratio Aspect ratio to maintain.
|
||||
*/
|
||||
void setAspectRatio(float ratio);
|
||||
|
||||
/**
|
||||
* @brief Sets the width of the preview image; height is adjusted according to the aspect ratio.
|
||||
* @param width Desired width in pixels.
|
||||
*/
|
||||
void setPreviewWidth(int width);
|
||||
|
||||
QLabel *imageLabel;
|
||||
ShadowBackgroundLabel *topLeftLabel;
|
||||
ShadowBackgroundLabel *topRightLabel;
|
||||
ShadowBackgroundLabel *bottomLeftLabel;
|
||||
ShadowBackgroundLabel *bottomRightLabel;
|
||||
QLabel *imageLabel; ///< QLabel to display the deck image
|
||||
ShadowBackgroundLabel *topLeftLabel; ///< Overlay label at top-left (deck name)
|
||||
ShadowBackgroundLabel *topRightLabel; ///< Overlay label at top-right (card count)
|
||||
ShadowBackgroundLabel *bottomLeftLabel; ///< Overlay label at bottom-left (EDH bracket)
|
||||
ShadowBackgroundLabel *bottomRightLabel; ///< Overlay label at bottom-right (views)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Handles resize events to reposition the image and overlay labels.
|
||||
* @param event Resize event.
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
float aspectRatio = 1.0f;
|
||||
float aspectRatio = 1.0f; ///< Aspect ratio to maintain for the preview image
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_ARCHIDEKT_DECK_PREVIEW_IMAGE_DISPLAY_WIDGET_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue