40 lines
974 B
C++
40 lines
974 B
C++
#ifndef CARDINFOPOPUP_H
|
|
#define CARDINFOPOPUP_H
|
|
|
|
#include <QWidget>
|
|
#include <QPropertyAnimation>
|
|
#include <QTimer>
|
|
|
|
class QLabel;
|
|
|
|
class CardInfoPopup : public QWidget {
|
|
Q_OBJECT
|
|
Q_PROPERTY(qreal popupOpacity READ popupOpacity WRITE setPopupOpacity)
|
|
public:
|
|
explicit CardInfoPopup(QWidget* parent = nullptr);
|
|
void showForCard(const QString& typeId, const QPoint& globalPos);
|
|
void hidePopup();
|
|
|
|
qreal popupOpacity() const { return _opacity; }
|
|
void setPopupOpacity(qreal o) { _opacity = o; update(); }
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent* event) override;
|
|
|
|
private:
|
|
void doFadeOut();
|
|
|
|
QLabel* _nameLabel = nullptr;
|
|
QLabel* _mpLabel = nullptr;
|
|
QLabel* _priorityLabel = nullptr;
|
|
QLabel* _winLabel = nullptr;
|
|
QLabel* _effectLabel = nullptr;
|
|
QPropertyAnimation* _fadeAnim = nullptr;
|
|
QTimer* _hideTimer = nullptr;
|
|
qreal _opacity = 0.0;
|
|
QString _currentTypeId;
|
|
bool _showRequested = false;
|
|
};
|
|
|
|
#endif
|