mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 19:13:55 -07:00
Properly manage hover-zoom child widget in CardInfoPictureWidget destructor. (#5900)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
baa7e25e30
commit
9ae6357c34
2 changed files with 14 additions and 0 deletions
|
|
@ -64,6 +64,12 @@ CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverT
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CardInfoPictureWidget::~CardInfoPictureWidget()
|
||||||
|
{
|
||||||
|
enlargedPixmapWidget->hide();
|
||||||
|
enlargedPixmapWidget->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the card to be displayed and updates the pixmap.
|
* @brief Sets the card to be displayed and updates the pixmap.
|
||||||
* @param card A shared pointer to the card information (CardInfoPtr).
|
* @param card A shared pointer to the card information (CardInfoPtr).
|
||||||
|
|
@ -341,6 +347,12 @@ void CardInfoPictureWidget::mousePressEvent(QMouseEvent *event)
|
||||||
emit cardClicked();
|
emit cardClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CardInfoPictureWidget::hideEvent(QHideEvent *event)
|
||||||
|
{
|
||||||
|
enlargedPixmapWidget->hide();
|
||||||
|
QWidget::hideEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
QMenu *CardInfoPictureWidget::createRightClickMenu()
|
QMenu *CardInfoPictureWidget::createRightClickMenu()
|
||||||
{
|
{
|
||||||
auto *cardMenu = new QMenu(this);
|
auto *cardMenu = new QMenu(this);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public:
|
||||||
explicit CardInfoPictureWidget(QWidget *parent = nullptr,
|
explicit CardInfoPictureWidget(QWidget *parent = nullptr,
|
||||||
bool hoverToZoomEnabled = false,
|
bool hoverToZoomEnabled = false,
|
||||||
bool raiseOnEnter = false);
|
bool raiseOnEnter = false);
|
||||||
|
~CardInfoPictureWidget();
|
||||||
CardInfoPtr getInfo()
|
CardInfoPtr getInfo()
|
||||||
{
|
{
|
||||||
return info;
|
return info;
|
||||||
|
|
@ -52,6 +53,7 @@ protected:
|
||||||
void moveEvent(QMoveEvent *event) override;
|
void moveEvent(QMoveEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
void hideEvent(QHideEvent *event) override;
|
||||||
void loadPixmap();
|
void loadPixmap();
|
||||||
[[nodiscard]] const QPixmap &getResizedPixmap() const
|
[[nodiscard]] const QPixmap &getResizedPixmap() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue