![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#include <card_info_picture_with_text_overlay_widget.h>
Public Member Functions | |
| CardInfoPictureWithTextOverlayWidget (QWidget *parent=nullptr, bool hoverToZoomEnabled=false, bool raiseOnEnter=false, const QColor &textColor=Qt::white, const QColor &outlineColor=Qt::black, int fontSize=12, Qt::Alignment alignment=Qt::AlignCenter) | |
| Constructs a CardPictureWithTextOverlay widget. | |
| void | setOverlayText (const QString &text) |
| Sets the overlay text to be displayed on the card. | |
| void | setTextColor (const QColor &color) |
| Sets the color of the overlay text. | |
| void | setOutlineColor (const QColor &color) |
| Sets the outline color around the overlay text. | |
| void | setFontSize (int size) |
| Sets the font size for the overlay text. | |
| void | setTextAlignment (Qt::Alignment alignment) |
| Sets the alignment of the overlay text within the widget. | |
| void | setHighlighted (bool _highlighted) |
| QSize | sizeHint () const override |
| Provides the recommended size for this widget. | |
| Public Member Functions inherited from CardInfoPictureWidget | |
| CardInfoPictureWidget (QWidget *parent=nullptr, bool hoverToZoomEnabled=false, bool raiseOnEnter=false) | |
| Constructs a CardInfoPictureWidget. | |
| ExactCard | getCard () |
| QSize | sizeHint () const override |
| Provides the recommended size for the widget based on the scale factor. | |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *event) override |
| Paints the widget, including both the card image and the text overlay. | |
| void | mousePressEvent (QMouseEvent *event) override |
| QSize | minimumSizeHint () const override |
| Provides the minimum recommended size for this widget. | |
| Protected Member Functions inherited from CardInfoPictureWidget | |
| void | resizeEvent (QResizeEvent *event) override |
| Handles widget resizing by updating the pixmap size. | |
| void | paintEvent (QPaintEvent *) override |
| Custom paint event that draws the card image with rounded corners. | |
| void | enterEvent (QEnterEvent *event) override |
| Starts the hover timer to show the enlarged pixmap on hover. | |
| void | leaveEvent (QEvent *event) override |
| Stops the hover timer and hides the enlarged pixmap when the mouse leaves. | |
| void | moveEvent (QMoveEvent *event) override |
| void | mouseMoveEvent (QMouseEvent *event) override |
| Moves the enlarged pixmap widget to follow the mouse cursor. | |
| void | mousePressEvent (QMouseEvent *event) override |
| void | hideEvent (QHideEvent *event) override |
| void | loadPixmap () |
| Loads the appropriate pixmap based on the current card info. | |
| const QPixmap & | getResizedPixmap () const |
| void | showEnlargedPixmap () |
| Displays the enlarged version of the card's pixmap near the cursor. | |
| void | destroyEnlargedPixmapWidget () |
Private Member Functions | |
| void | drawOutlinedText (QPainter &painter, const QRect &textRect, const QString &text, const QTextOption &textOption) const |
| Draws text with an outline for visibility. | |
Private Attributes | |
| QString | overlayText |
| QColor | textColor |
| QColor | outlineColor |
| int | fontSize |
| Qt::Alignment | textAlignment |
| bool | highlighted |
Additional Inherited Members | |
| Public Slots inherited from CardInfoPictureWidget | |
| void | setCard (const ExactCard &card) |
| Sets the card to be displayed and updates the pixmap. | |
| void | setScaleFactor (int scale) |
| Sets the scale factor for the widget. | |
| void | setHoverToZoomEnabled (bool enabled) |
| Sets the hover to zoom feature. | |
| void | setRaiseOnEnterEnabled (bool enabled) |
| void | updatePixmap () |
| Marks the pixmap as dirty and triggers a widget repaint. | |
| Signals inherited from CardInfoPictureWidget | |
| void | hoveredOnCard (const ExactCard &hoveredCard) |
| void | cardScaleFactorChanged (int _scale) |
| void | cardChanged (const ExactCard &card) |
| void | cardClicked (QMouseEvent *event, const ExactCard &card) |
|
explicit |
Constructs a CardPictureWithTextOverlay widget.
| parent | The parent widget. |
| hoverToZoomEnabled | If this widget will spawn a larger widget when hovered over. |
| raiseOnEnter | If this widget will raise slightly when entered. |
| textColor | The color of the overlay text. |
| outlineColor | The color of the outline around the text. |
| fontSize | The font size of the overlay text. |
| alignment | The alignment of the text within the overlay. |
Sets the widget's size policy and default border style.
|
private |
Draws text with an outline for visibility.
| painter | The painter to draw the text. |
| textRect | The rectangle area to draw the text in. |
| text | The text to display. |
| textOption | The text layout options, such as alignment. |
Draws an outline around the text to enhance readability before drawing the main text.
|
nodiscardoverrideprotected |
Provides the minimum recommended size for this widget.
|
overrideprotected |
|
overrideprotected |
Paints the widget, including both the card image and the text overlay.
| event | The paint event. |
Draws the card image first, then overlays text on top. The text is wrapped and centered within the image.
| void CardInfoPictureWithTextOverlayWidget::setFontSize | ( | int | size | ) |
Sets the font size for the overlay text.
| size | The new font size. |
| void CardInfoPictureWithTextOverlayWidget::setHighlighted | ( | bool | _highlighted | ) |
| void CardInfoPictureWithTextOverlayWidget::setOutlineColor | ( | const QColor & | color | ) |
Sets the outline color around the overlay text.
| color | The new outline color. |
| void CardInfoPictureWithTextOverlayWidget::setOverlayText | ( | const QString & | text | ) |
Sets the overlay text to be displayed on the card.
| text | The text to overlay. |
Updates the widget to display the new overlay text.
| void CardInfoPictureWithTextOverlayWidget::setTextAlignment | ( | Qt::Alignment | alignment | ) |
Sets the alignment of the overlay text within the widget.
| alignment | The new text alignment. |
| void CardInfoPictureWithTextOverlayWidget::setTextColor | ( | const QColor & | color | ) |
Sets the color of the overlay text.
| color | The new text color. |
|
nodiscardoverride |
Provides the recommended size for this widget.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |