| 82 | QWidget* ElaPopularCard::getCardFloatArea() const |
| 83 | { |
| 84 | Q_D(const ElaPopularCard); |
| 85 | return d->_pCardFloatArea; |
| 86 | } |
| 87 | |
| 88 | bool ElaPopularCard::event(QEvent* event) |
| 89 | { |
| 90 | Q_D(ElaPopularCard); |
| 91 | switch (event->type()) |
| 92 | { |
| 93 | case QEvent::Enter: |
| 94 | { |
| 95 | d->_floatTimer->start(450); |
| 96 | QPropertyAnimation* hoverAnimation = new QPropertyAnimation(d, "pHoverYOffset"); |
| 97 | connect(hoverAnimation, &QPropertyAnimation::valueChanged, this, [=]() { |
| 98 | update(); |
| 99 | }); |
| 100 | hoverAnimation->setDuration(130); |
| 101 | hoverAnimation->setStartValue(d->_pHoverYOffset); |
| 102 | hoverAnimation->setEndValue(6); |
| 103 | hoverAnimation->start(QAbstractAnimation::DeleteWhenStopped); |
| 104 | QPropertyAnimation* opacityAnimation = new QPropertyAnimation(d, "pHoverOpacity"); |
| 105 | opacityAnimation->setDuration(130); |
| 106 | opacityAnimation->setStartValue(d->_pHoverOpacity); |
| 107 | opacityAnimation->setEndValue(1); |
| 108 | opacityAnimation->start(QAbstractAnimation::DeleteWhenStopped); |
| 109 | break; |
| 110 | } |
| 111 | case QEvent::Leave: |
| 112 | { |
| 113 | d->_floatTimer->stop(); |
| 114 | QPropertyAnimation* hoverAnimation = new QPropertyAnimation(d, "pHoverYOffset"); |
| 115 | connect(hoverAnimation, &QPropertyAnimation::valueChanged, this, [=]() { |
| 116 | update(); |
| 117 | }); |
| 118 | hoverAnimation->setDuration(130); |
| 119 | hoverAnimation->setStartValue(d->_pHoverYOffset); |
| 120 | hoverAnimation->setEndValue(0); |
| 121 | hoverAnimation->start(QAbstractAnimation::DeleteWhenStopped); |
| 122 | QPropertyAnimation* opacityAnimation = new QPropertyAnimation(d, "pHoverOpacity"); |
| 123 | opacityAnimation->setDuration(130); |
| 124 | opacityAnimation->setStartValue(d->_pHoverOpacity); |
| 125 | opacityAnimation->setEndValue(0); |
| 126 | opacityAnimation->start(QAbstractAnimation::DeleteWhenStopped); |
| 127 | break; |
| 128 | } |
| 129 | case QEvent::MouseButtonRelease: |
| 130 | { |
| 131 | Q_EMIT popularCardClicked(); |
| 132 | break; |
| 133 | } |
| 134 | default: |
| 135 | { |
| 136 | break; |
| 137 | } |
| 138 | } |
| 139 | return QWidget::event(event); |
nothing calls this directly
no outgoing calls
no test coverage detected