/** * @file card_info_picture_widget.h * @ingroup CardWidgets */ //! \todo Document this file. #ifndef CARD_INFO_PICTURE_H #define CARD_INFO_PICTURE_H #include "card_info_picture_enlarged_widget.h" #include #include #include inline Q_LOGGING_CATEGORY(CardInfoPictureWidgetLog, "card_info_picture_widget"); class AbstractCardItem; class QMenu; class CardInfoPictureWidget : public QWidget { Q_OBJECT public: explicit CardInfoPictureWidget(QWidget *parent = nullptr, bool hoverToZoomEnabled = false, bool raiseOnEnter = false); ExactCard getCard() { return exactCard; } [[nodiscard]] QSize sizeHint() const override; public slots: void setCard(const ExactCard &card); void setScaleFactor(int scale); // New slot for scaling void setHoverToZoomEnabled(bool enabled); void setRaiseOnEnterEnabled(bool enabled); void updatePixmap(); signals: void hoveredOnCard(const ExactCard &hoveredCard); void cardScaleFactorChanged(int _scale); void cardChanged(const ExactCard &card); void cardClicked(QMouseEvent *event, const ExactCard &card); protected: void resizeEvent(QResizeEvent *event) override; void paintEvent(QPaintEvent *) override; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEnterEvent *event) override; // Qt6 signature #else void enterEvent(QEvent *event) override; // Qt5 signature #endif void leaveEvent(QEvent *event) override; void moveEvent(QMoveEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void hideEvent(QHideEvent *event) override; void loadPixmap(); [[nodiscard]] const QPixmap &getResizedPixmap() const { return resizedPixmap; } void showEnlargedPixmap(); void destroyEnlargedPixmapWidget(); private: ExactCard exactCard; double scaleFactor = 100; QPixmap resizedPixmap; bool pixmapDirty; bool hoverToZoomEnabled; bool raiseOnEnter; CardInfoPictureEnlargedWidget *enlargedPixmapWidget = nullptr; QTimer *hoverTimer; QPropertyAnimation *animation; QPoint originalPos; // Store the original position QMenu *createRightClickMenu(); QMenu *createViewRelatedCardsMenu(); QMenu *createAddToOpenDeckMenu(); }; #endif