bool MediaView::updateOverState(OverState newState) { bool result = true; if (_over != newState) { if (_over != OverNone) { _animations[_over] = getms(); ShowingOpacities::iterator i = _animOpacities.find(_over); if (i != _animOpacities.end()) { i->start(0); } else { _animOpacities.insert(_over, anim::fvalue(1, 0)); } anim::start(this); if (newState != OverNone) update(); } else { result = false; } _over = newState; if (newState != OverNone) { _animations[_over] = getms(); ShowingOpacities::iterator i = _animOpacities.find(_over); if (i != _animOpacities.end()) { i->start(1); } else { _animOpacities.insert(_over, anim::fvalue(0, 1)); } anim::start(this); setCursor(style::cur_pointer); } else { setCursor(style::cur_default); } } return result; }
void WarningWidget::paintEvent(QPaintEvent *e) { Painter p(this); if (!_cache.isNull()) { if (!_animation.animating(getms())) { if (isHidden()) { return; } } p.setOpacity(_animation.current(_hiding ? 0. : 1.)); p.drawPixmap(_outer.topLeft(), _cache); if (!_animation.animating()) { _cache = QPixmap(); showChildren(); _started = getms(true); _timer.start(100); } return; } Ui::Shadow::paint(p, _inner, width(), st::boxRoundShadow); App::roundRect(p, _inner, st::boxBg, BoxCorners); p.setFont(st::boxTitleFont); p.setPen(st::boxTitleFg); p.drawTextLeft(_inner.x() + st::boxTitlePosition.x(), _inner.y() + st::boxTitlePosition.y(), width(), lang(lng_theme_sure_keep)); p.setFont(st::boxTextFont); p.setPen(st::boxTextFg); p.drawTextLeft(_inner.x() + st::boxTitlePosition.x(), _inner.y() + st::themeWarningTextTop, width(), _text); }
void TaskQueue::ProcessMainTasks(TimeMs max_time_spent) { // static t_assert(QThread::currentThreadId() == MainThreadId); auto start_time = getms(); while (ProcessOneMainTask()) { if (getms() >= start_time + max_time_spent) { break; } } }
void EmojiButton::paintEvent(QPaintEvent *e) { Painter p(this); auto ms = getms(); p.fillRect(e->rect(), st::historyComposeAreaBg); paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms); auto loading = a_loading.current(ms, _loading ? 1 : 0); p.setOpacity(1 - loading); auto over = isOver(); auto icon = &(over ? _st.iconOver : _st.icon); icon->paint(p, _st.iconPosition, width()); p.setOpacity(1.); auto pen = (over ? st::historyEmojiCircleFgOver : st::historyEmojiCircleFg)->p; pen.setWidth(st::historyEmojiCircleLine); pen.setCapStyle(Qt::RoundCap); p.setPen(pen); p.setBrush(Qt::NoBrush); PainterHighQualityEnabler hq(p); QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle); if (loading > 0) { int32 full = FullArcLength; int32 start = qRound(full * float64(ms % st::historyEmojiCirclePeriod) / st::historyEmojiCirclePeriod), part = qRound(loading * full / st::historyEmojiCirclePart); p.drawArc(inner, start, full - part); } else { p.drawEllipse(inner); } }
void PsMainWindow::psUpdateCounter() { setWindowIcon(wndIcon); int32 counter = App::histories().unreadFull; setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram")); if (_psUnityLauncherEntry) { if (counter > 0) { ps_unity_launcher_entry_set_count(_psUnityLauncherEntry, (counter > 9999) ? 9999 : counter); ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, TRUE); } else { ps_unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE); } } if (noQtTrayIcon) { if (useAppIndicator) { if (getms() > _psLastIndicatorUpdate + 1000) { psUpdateIndicator(); } else if (!_psUpdateIndicatorTimer.isActive()) { _psUpdateIndicatorTimer.start(100); } } else if (useStatusIcon && trayIconChecked) { loadPixbuf(_trayIconImageGen()); ps_gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf); } } else if (trayIcon) { int32 counter = App::histories().unreadFull; style::color bg = (App::histories().unreadMuted < counter) ? st::counterBG : st::counterMuteBG; QIcon iconSmall; iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly)); iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly)); trayIcon->setIcon(iconSmall); } }
QString CachedUserpics::get(const StorageKey &key, PeerData *peer) { auto ms = getms(true); auto i = _images.find(key); if (i != _images.cend()) { if (i->until) { i->until = ms + kNotifyDeletePhotoAfterMs; clearInMs(-kNotifyDeletePhotoAfterMs); } } else { Image v; if (key.first) { v.until = ms + kNotifyDeletePhotoAfterMs; clearInMs(-kNotifyDeletePhotoAfterMs); } else { v.until = 0; } v.path = cWorkingDir() + qsl("tdata/temp/") + QString::number(rand_value<uint64>(), 16) + qsl(".png"); if (key.first || key.second) { if (_type == Type::Rounded) { peer->saveUserpicRounded(v.path, st::notifyMacPhotoSize); } else { peer->saveUserpic(v.path, st::notifyMacPhotoSize); } } else { App::wnd()->iconLarge().save(v.path, "PNG"); } i = _images.insert(key, v); _someSavedFlag = true; } return i->path; }
void CachedUserpics::onClear() { auto ms = getms(true); auto minuntil = clear(ms); if (minuntil) { clearInMs(int(minuntil - ms)); } }
void MembersBox::Inner::paintEvent(QPaintEvent *e) { QRect r(e->rect()); Painter p(this); _time = unixtime(); p.fillRect(r, st::contactsBg); auto ms = getms(); auto yFrom = r.y() - st::membersMarginTop; auto yTo = r.y() + r.height() - st::membersMarginTop; p.translate(0, st::membersMarginTop); if (_rows.isEmpty()) { p.setFont(st::noContactsFont); p.setPen(st::noContactsColor); p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center); } else { int32 from = floorclamp(yFrom, _rowHeight, 0, _rows.size()); int32 to = ceilclamp(yTo, _rowHeight, 0, _rows.size()); p.translate(0, from * _rowHeight); for (; from < to; ++from) { auto selected = (_pressed >= 0) ? (from == _pressed) : (from == _selected); auto kickSelected = (_pressed >= 0) ? (from == _kickPressed && from == _kickSelected) : (from == _kickSelected); paintDialog(p, ms, _rows[from], data(from), selected, kickSelected); p.translate(0, _rowHeight); } if (to == _rows.size() && _filter == MembersFilter::Recent && (_rows.size() < _channel->membersCount() || _rows.size() >= Global::ChatSizeMax())) { p.setPen(st::membersAboutLimitFg); _about.draw(p, st::contactsPadding.left(), st::membersAboutLimitPadding.top(), _aboutWidth, style::al_center); } } }
void PopupMenu::paintEvent(QPaintEvent *e) { Painter p(this); #ifdef OS_MAC_OLD p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(e->rect(), Qt::transparent); p.setCompositionMode(QPainter::CompositionMode_SourceOver); #endif // OS_MAC_OLD auto ms = getms(); if (_a_show.animating(ms)) { if (auto opacity = _a_opacity.current(ms, _hiding ? 0. : 1.)) { _showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity); } } else if (_a_opacity.animating(ms)) { p.setOpacity(_a_opacity.current(0.)); p.drawPixmap(0, 0, _cache); } else if (_hiding || isHidden()) { hideFinished(); } else if (_showAnimation) { _showAnimation->paintFrame(p, 0, 0, width(), 1., 1.); _showAnimation.reset(); showChildren(); } else { paintBg(p); } }
void HistoryDownButton::paintEvent(QPaintEvent *e) { Painter p(this); float64 opacity = 1.; if (_a_show.animating(getms())) { opacity = _a_show.current(); p.setOpacity(opacity); p.drawPixmap(0, st::historyToDownPaddingTop, _cache); } else if (!_shown) { hide(); return; } else { st::historyToDown.paint(p, QPoint(0, st::historyToDownPaddingTop), width()); } p.setOpacity(opacity * a_arrowOpacity.current()); st::historyToDownArrow.paint(p, QPoint(0, st::historyToDownPaddingTop), width()); if (_unreadCount > 0) { p.setOpacity(opacity); auto unreadString = QString::number(_unreadCount); if (unreadString.size() > 4) { unreadString = qsl("..") + unreadString.mid(unreadString.size() - 4); } Dialogs::Layout::UnreadBadgeStyle st; st.align = style::al_center; st.font = st::historyToDownBadgeFont; st.size = st::historyToDownBadgeSize; st.sizeId = Dialogs::Layout::UnreadBadgeInHistoryToDown; Dialogs::Layout::paintUnreadCount(p, unreadString, width(), 0, st, nullptr); } }
void FilledSlider::paintEvent(QPaintEvent *e) { Painter p(this); PainterHighQualityEnabler hq(p); p.setPen(Qt::NoPen); auto masterOpacity = fadeOpacity(); auto ms = getms(); auto disabled = isDisabled(); auto over = getCurrentOverFactor(ms); auto lineWidth = _st.lineWidth + ((_st.fullWidth - _st.lineWidth) * over); auto lineWidthRounded = qFloor(lineWidth); auto lineWidthPartial = lineWidth - lineWidthRounded; auto seekRect = getSeekRect(); auto value = getCurrentValue(ms); auto from = seekRect.x(), mid = qRound(from + value * seekRect.width()), end = from + seekRect.width(); if (mid > from) { p.setOpacity(masterOpacity); p.fillRect(from, height() - lineWidthRounded, (mid - from), lineWidthRounded, disabled ? _st.disabledFg : _st.activeFg); if (lineWidthPartial > 0.01) { p.setOpacity(masterOpacity * lineWidthPartial); p.fillRect(from, height() - lineWidthRounded - 1, (mid - from), 1, disabled ? _st.disabledFg : _st.activeFg); } } if (end > mid && over > 0) { p.setOpacity(masterOpacity * over); p.fillRect(mid, height() - lineWidthRounded, (end - mid), lineWidthRounded, _st.inactiveFg); if (lineWidthPartial > 0.01) { p.setOpacity(masterOpacity * over * lineWidthPartial); p.fillRect(mid, height() - lineWidthRounded - 1, (end - mid), 1, _st.inactiveFg); } } }
void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) { auto windowHandle = widget->window()->windowHandle(); auto localPoint = windowHandle->mapFromGlobal(globalPoint); QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, QGuiApplication::mouseButtons() | button, QGuiApplication::keyboardModifiers(), Qt::MouseEventSynthesizedByApplication); ev.setTimestamp(getms()); QGuiApplication::sendEvent(windowHandle, &ev); }
void PlayButtonLayout::paint(Painter &p, const QBrush &brush) { if (_transformProgress.animating(getms())) { auto from = _oldState, to = _state; auto backward = _transformBackward; auto progress = _transformProgress.current(1.); if (from == State::Cancel || (from == State::Pause && to == State::Play)) { qSwap(from, to); backward = !backward; } if (backward) progress = 1. - progress; t_assert(from != to); if (from == State::Play) { if (to == State::Pause) { paintPlayToPause(p, brush, progress); } else { t_assert(to == State::Cancel); paintPlayToCancel(p, brush, progress); } } else { t_assert(from == State::Pause && to == State::Cancel); paintPauseToCancel(p, brush, progress); } } else { switch (_state) { case State::Play: paintPlay(p, brush); break; case State::Pause: paintPlayToPause(p, brush, 1.); break; case State::Cancel: paintPlayToCancel(p, brush, 1.); break; } } }
TimeMs Timer::remainingTime() const { if (!isActive()) { return -1; } auto now = getms(true); return (_next > now) ? (_next - now) : TimeMs(0); }
void Float::paintEvent(QPaintEvent *e) { Painter p(this); p.setOpacity(_opacity); p.drawPixmap(0, 0, _shadow); if (!fillFrame() && _toggleCallback) { _toggleCallback(false); } auto inner = getInnerRect(); p.drawImage(inner.topLeft(), _frame); auto progress = _roundPlayback ? _roundPlayback->value(getms()) : 1.; if (progress > 0.) { auto pen = st::historyVideoMessageProgressFg->p; auto was = p.pen(); pen.setWidth(st::radialLine); pen.setCapStyle(Qt::RoundCap); p.setPen(pen); p.setOpacity(_opacity * st::historyVideoMessageProgressOpacity); auto from = QuarterArcLength; auto len = -qRound(FullArcLength * progress); auto stepInside = st::radialLine / 2; { PainterHighQualityEnabler hq(p); p.drawArc(inner.marginsRemoved(QMargins(stepInside, stepInside, stepInside, stepInside)), from, len); } //p.setPen(was); //p.setOpacity(_opacity); } }
void Window::notifySchedule(History *history, MsgId msgId) { if (App::quiting() || !history->currentNotification()) return; bool haveSetting = (history->peer->notify != UnknownNotifySettings); if (haveSetting) { if (history->peer->notify != EmptyNotifySettings && history->peer->notify->mute > unixtime()) { history->clearNotifications(); return; } } else { App::wnd()->getNotifySetting(MTP_inputNotifyPeer(history->peer->input)); } uint64 ms = getms(true) + NotifyWaitTimeout; notifyWhenAlerts[history].insert(ms, NullType()); if (cDesktopNotify()) { NotifyWhenMaps::iterator i = notifyWhenMaps.find(history); if (i == notifyWhenMaps.end()) { i = notifyWhenMaps.insert(history, NotifyWhenMap()); } if (i.value().constFind(msgId) == i.value().cend()) { i.value().insert(msgId, ms); } NotifyWaiters *addTo = haveSetting ? ¬ifyWaiters : ¬ifySettingWaiters; if (addTo->constFind(history) == addTo->cend()) { addTo->insert(history, NotifyWaiter(msgId, ms)); } } if (haveSetting) { if (!notifyWaitTimer.isActive()) { notifyWaitTimer.start(NotifyWaitTimeout); } } }
void InnerDropdown::otherLeave() { if (_a_appearance.animating(getms())) { onHideStart(); } else { _hideTimer.start(0); } }
void ChatSearchFromController::rebuildRows() { auto ms = getms(); auto wasEmpty = !delegate()->peerListFullRowsCount(); auto now = unixtime(); QMultiMap<int32, UserData*> ordered; if (_chat->noParticipantInfo()) { AuthSession::Current().api().requestFullPeer(_chat); } else if (!_chat->participants.isEmpty()) { for (auto i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) { auto user = i.key(); ordered.insertMulti(App::onlineForSort(user, now), user); } } for_const (auto user, _chat->lastAuthors) { if (user->isInaccessible()) continue; appendRow(user); if (!ordered.isEmpty()) { ordered.remove(App::onlineForSort(user, now), user); } } if (!ordered.isEmpty()) { for (auto i = ordered.cend(), b = ordered.cbegin(); i != b;) { appendRow(*(--i)); } } checkForEmptyRows(); delegate()->peerListRefreshRows(); }
void EmojiButton::paintEvent(QPaintEvent *e) { Painter p(this); uint64 ms = getms(); float64 loading = a_loading.current(ms, _loading ? 1 : 0); p.setOpacity(_opacity * (1 - loading)); p.fillRect(e->rect(), a_bg.current()); p.setOpacity(a_opacity.current() * _opacity * (1 - loading)); const style::sprite &i((_state & StateDown) ? _st.downIcon : _st.icon); if (!i.isEmpty()) { const QPoint &t((_state & StateDown) ? _st.downIconPos : _st.iconPos); p.drawSprite(t, i); } p.setOpacity(a_opacity.current() * _opacity); p.setPen(QPen(st::emojiCircleFg, st::emojiCircleLine)); p.setBrush(Qt::NoBrush); p.setRenderHint(QPainter::HighQualityAntialiasing); QRect inner(QPoint((width() - st::emojiCircle.width()) / 2, st::emojiCircleTop), st::emojiCircle); if (loading > 0) { int32 full = 5760; int32 start = qRound(full * float64(ms % uint64(st::emojiCirclePeriod)) / st::emojiCirclePeriod), part = qRound(loading * full / st::emojiCirclePart); p.drawArc(inner, start, full - part); } else { p.drawEllipse(inner); } p.setRenderHint(QPainter::HighQualityAntialiasing, false); }
void MultiSelect::Inner::Item::paint(Painter &p, int outerWidth, TimeMs ms) { if (!_cache.isNull() && !_visibility.animating(ms)) { if (_hiding) { return; } else { _cache = QPixmap(); } } if (_copies.empty()) { paintOnce(p, _x, _y, outerWidth, ms); } else { for (auto i = _copies.begin(), e = _copies.end(); i != e;) { auto x = qRound(i->x.current(getms(), _x)); auto y = i->y; auto animating = i->x.animating(); if (animating || (y == _y)) { paintOnce(p, x, y, outerWidth, ms); } if (animating) { ++i; } else { i = _copies.erase(i); e = _copies.end(); } } } }
void MediaSlider::paintEvent(QPaintEvent *e) { Painter p(this); PainterHighQualityEnabler hq(p); p.setPen(Qt::NoPen); p.setOpacity(fadeOpacity()); auto horizontal = isHorizontal(); auto ms = getms(); auto radius = _st.width / 2; auto disabled = isDisabled(); auto over = getCurrentOverFactor(ms); auto seekRect = getSeekRect(); auto value = getCurrentValue(ms); // invert colors and value for vertical if (!horizontal) value = 1. - value; auto markerFrom = (horizontal ? seekRect.x() : seekRect.y()); auto markerLength = (horizontal ? seekRect.width() : seekRect.height()); auto from = _alwaysDisplayMarker ? 0 : markerFrom; auto length = _alwaysDisplayMarker ? (horizontal ? width() : height()) : markerLength; auto mid = qRound(from + value * length); auto end = from + length; auto activeFg = disabled ? _st.activeFgDisabled : anim::brush(_st.activeFg, _st.activeFgOver, over); auto inactiveFg = disabled ? _st.inactiveFgDisabled : anim::brush(_st.inactiveFg, _st.inactiveFgOver, over); if (mid > from) { auto fromClipRect = horizontal ? QRect(0, 0, mid, height()) : QRect(0, 0, width(), mid); auto fromRect = horizontal ? QRect(from, (height() - _st.width) / 2, mid + radius - from, _st.width) : QRect((width() - _st.width) / 2, from, _st.width, mid + radius - from); p.setClipRect(fromClipRect); p.setBrush(horizontal ? activeFg : inactiveFg); p.drawRoundedRect(fromRect, radius, radius); } if (end > mid) { auto endClipRect = horizontal ? QRect(mid, 0, width() - mid, height()) : QRect(0, mid, width(), height() - mid); auto endRect = horizontal ? QRect(mid - radius, (height() - _st.width) / 2, end - (mid - radius), _st.width) : QRect((width() - _st.width) / 2, mid - radius, _st.width, end - (mid - radius)); p.setClipRect(endClipRect); p.setBrush(horizontal ? inactiveFg : activeFg); p.drawRoundedRect(endRect, radius, radius); } auto markerSizeRatio = disabled ? 0. : (_alwaysDisplayMarker ? 1. : over); if (markerSizeRatio > 0) { auto position = qRound(markerFrom + value * markerLength) - (horizontal ? seekRect.x() : seekRect.y()); auto seekButton = horizontal ? QRect(position, (height() - _st.seekSize.height()) / 2, _st.seekSize.width(), _st.seekSize.height()) : QRect((width() - _st.seekSize.width()) / 2, position, _st.seekSize.width(), _st.seekSize.height()); auto size = horizontal ? _st.seekSize.width() : _st.seekSize.height(); auto remove = static_cast<int>(((1. - markerSizeRatio) * size) / 2.); if (remove * 2 < size) { p.setClipRect(rect()); p.setBrush(activeFg); p.drawEllipse(seekButton.marginsRemoved(QMargins(remove, remove, remove, remove))); } } }
QRect psDesktopRect() { uint64 tnow = getms(true); if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) { _monitorLastGot = tnow; _monitorRect = QApplication::desktop()->availableGeometry(App::wnd()); } return _monitorRect; }
void BackgroundRow::radialStart() { if (radialLoading() && !_radial.animating()) { _radial.start(radialProgress()); if (auto shift = radialTimeShift()) { _radial.update(radialProgress(), !radialLoading(), getms() + shift); } } }
void InnerDropdown::leaveEvent(QEvent *e) { if (_a_appearance.animating(getms())) { onHideStart(); } else { _hideTimer.start(300); } return TWidget::leaveEvent(e); }
void SingleTimer::start(int msec) { _finishing = getms(true) + (msec < 0 ? 0 : uint64(msec)); if (!_inited && App::app()) { connect(App::app(), SIGNAL(adjustSingleTimers()), this, SLOT(adjust())); _inited = true; } QTimer::start(msec); }
void Application::killDownloadSessionsStart(int32 dc) { if (killDownloadSessionTimes.constFind(dc) == killDownloadSessionTimes.cend()) { killDownloadSessionTimes.insert(dc, getms() + MTPAckSendWaiting + MTPKillFileSessionTimeout); } if (!killDownloadSessionsTimer.isActive()) { killDownloadSessionsTimer.start(MTPAckSendWaiting + MTPKillFileSessionTimeout + 5); } }
void InnerDropdown::otherLeave() { auto ms = getms(); if (_a_show.animating(ms) || _a_opacity.animating(ms)) { hideAnimated(); } else { _hideTimer.start(0); } }
void RoundButton::Numbers::setText(const QString &text, int value) { if (_a_ready.animating(getms())) { _delayedText = text; _delayedValue = value; } else { realSetText(text, value); } }
QPixmap MediaPreviewWidget::currentImage() const { if (_document) { if (_document->sticker()) { if (_cacheStatus != CacheLoaded) { _document->checkSticker(); if (_document->sticker()->img->isNull()) { if (_cacheStatus != CacheThumbLoaded && _document->thumb->loaded()) { QSize s = currentDimensions(); _cache = _document->thumb->pixBlurred(s.width(), s.height()); _cacheStatus = CacheThumbLoaded; } } else { QSize s = currentDimensions(); _cache = _document->sticker()->img->pix(s.width(), s.height()); _cacheStatus = CacheLoaded; } } } else { _document->automaticLoad(nullptr); if (_document->loaded()) { if (!_gif && _gif != BadClipReader) { MediaPreviewWidget *that = const_cast<MediaPreviewWidget*>(this); that->_gif = new ClipReader(_document->location(), _document->data(), func(that, &MediaPreviewWidget::clipCallback)); if (gif()) _gif->setAutoplay(); } } if (gif() && _gif->started()) { QSize s = currentDimensions(); return _gif->current(s.width(), s.height(), s.width(), s.height(), getms()); } if (_cacheStatus != CacheThumbLoaded && _document->thumb->loaded()) { QSize s = currentDimensions(); _cache = _document->thumb->pixBlurred(s.width(), s.height()); _cacheStatus = CacheThumbLoaded; } } } else if (_photo) { if (_cacheStatus != CacheLoaded) { if (_photo->full->loaded()) { QSize s = currentDimensions(); LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height())); _cache = _photo->full->pix(s.width(), s.height()); _cacheStatus = CacheLoaded; } else { if (_cacheStatus != CacheThumbLoaded && _photo->thumb->loaded()) { QSize s = currentDimensions(); LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height())); _cache = _photo->thumb->pixBlurred(s.width(), s.height()); _cacheStatus = CacheThumbLoaded; } _photo->thumb->load(); _photo->full->load(); } } } return _cache; }
void ToggleableShadow::paintEvent(QPaintEvent *e) { Painter p(this); if (_a_opacity.animating(getms())) { p.setOpacity(_a_opacity.current()); } else if (!_shown) { return; } p.fillRect(e->rect(), _color); }