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

Method ElaPromotionView

ElaWidgetTools/ElaPromotionView.cpp:10–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <QPainter>
9#include <QTimer>
10#include <QWheelEvent>
11
12ElaPromotionView::ElaPromotionView(QWidget* parent)
13 : QWidget{parent}, d_ptr(new ElaPromotionViewPrivate())
14{
15 Q_D(ElaPromotionView);
16 d->q_ptr = this;
17 d->_pCurrentIndex = 0;
18 d->_pCardExpandWidth = 600;
19 d->_pCardCollapseWidth = 300;
20 d->_pIsAutoScroll = false;
21 d->_pAutoScrollInterval = 5000;
22 setFixedHeight(300);
23 setObjectName("ElaPromotionView");
24 setStyleSheet("#ElaPromotionView{background-color:transparent;}");
25
26 d->_autoScrollTimer = new QTimer(this);
27 connect(d->_autoScrollTimer, &QTimer::timeout, this, [=]() {
28 if (isVisible() && d->_promotionCardList.count() > 2)
29 {
30 d->onPromotionCardClicked(d->_promotionCardList[d->_getAdjacentIndex(Qt::LeftToRight, d->_pCurrentIndex)]);
31 }
32 });
33
34 d->_themeMode = eTheme->getThemeMode();
35 connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) { d->_themeMode = themeMode; });
36}
37

Callers

nothing calls this directly

Calls 4

countMethod · 0.80
_getAdjacentIndexMethod · 0.80
getThemeModeMethod · 0.80

Tested by

no test coverage detected