MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / wheelEvent

Method wheelEvent

ElaWidgetTools/ElaPromotionView.cpp:145–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 });
144 d->_updatePromotionCardGeometry();
145}
146
147void 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

Callers

nothing calls this directly

Calls 2

_getAdjacentIndexMethod · 0.80

Tested by

no test coverage detected