| 143 | }); |
| 144 | d->_updatePromotionCardGeometry(); |
| 145 | } |
| 146 | |
| 147 | void ElaPromotionView::wheelEvent(QWheelEvent* event) |
| 148 | { |
| 149 | Q_D(ElaPromotionView); |
| 150 | if (d->_isAllowSwitch) |
| 151 | { |
| 152 | if (event->angleDelta().y() > 0) |
| 153 | { |
| 154 | //右滑 |
| 155 | d->_isAllowSwitch = false; |
| 156 | QTimer::singleShot(400, this, [=] { |
| 157 | d->_isAllowSwitch = true; |
| 158 | }); |
| 159 | d->onPromotionCardClicked(d->_promotionCardList[d->_getAdjacentIndex(Qt::RightToLeft, d->_pCurrentIndex)]); |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | //左滑 |
| 164 | d->_isAllowSwitch = false; |
| 165 | QTimer::singleShot(400, this, [=] { |
| 166 | d->_isAllowSwitch = true; |
| 167 | }); |
| 168 | d->onPromotionCardClicked(d->_promotionCardList[d->_getAdjacentIndex(Qt::LeftToRight, d->_pCurrentIndex)]); |
| 169 | } |
| 170 | } |
| 171 | event->accept(); |
| 172 | } |
| 173 |
nothing calls this directly
no test coverage detected