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

Method paintEvent

ElaWidgetTools/ElaCalendar.cpp:158–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 switchEasing.addCubicBezierSegment(QPointF(0, 0), QPointF(0, 1), QPointF(1, 1));
157 // 前 150 ms 退出旧视图 后 350 ms 进入新视图
158 connect(d->_switchAnimation, &QVariantAnimation::valueChanged, this, [this, d, switchEasing](const QVariant& value) {
159 const qreal progress = value.toReal();
160 d->_isDrawNewPix = progress >= 0.3;
161 const qreal phase = switchEasing.valueForProgress(d->_isDrawNewPix ? (progress - 0.3) / 0.7 : progress / 0.3);
162 const qreal zoom = d->_isDrawNewPix ? (d->_isZoomIn ? 0.84 : 1.29) : (d->_isZoomIn ? 1.29 : 0.84);
163 d->_zoomRatio = d->_isDrawNewPix ? zoom + (1 - zoom) * phase : 1 + (zoom - 1) * phase;
164 d->_pixOpacity = d->_isDrawNewPix ? phase : 1 - phase;
165 update();
166 });
167 connect(d->_switchAnimation, &QVariantAnimation::finished, this, [this, d]() {
168 d->_isSwitchAnimationFinished = true;
169 auto titlePolicy = d->_calendarTitleView->sizePolicy();
170 titlePolicy.setRetainSizeWhenHidden(false);
171 d->_calendarTitleView->setSizePolicy(titlePolicy);
172 d->_calendarTitleView->setVisible(d->_calendarModel->getDisplayMode() == DayMode);
173 d->_calendarView->show();
174 d->_oldCalendarViewPix = QPixmap();
175 d->_newCalendarViewPix = QPixmap();
176 d->_updateSwitchButtonText();
177 update();
178 });
179
180 d->_themeMode = eTheme->getThemeMode();
181 d->_updateNavigationIcons();
182 connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) {
183 d->_themeMode = themeMode;
184 d->_updateNavigationIcons();
185 });
186 setVisible(true);
187 QDate currentDate = QDate::currentDate();
188 d->_scrollToDate(currentDate);
189}
190
191ElaCalendar::~ElaCalendar()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected