本文整理汇总了C++中QPropertyAnimation::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::deleteLater方法的具体用法?C++ QPropertyAnimation::deleteLater怎么用?C++ QPropertyAnimation::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::deleteLater方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeDialog
void DialogController::closeDialog()
{
QWidget *dialog = m_dialog;
m_dialog = nullptr;
m_widget = nullptr;
if(!dialog)
return;
QRect geom = dialog->geometry();
int w = geom.width() + m_dialogOffsetLeft;
QPropertyAnimation *animation = new QPropertyAnimation(dialog, "geometry");
animation->setStartValue(visibleGeometry(dialog));
animation->setEndValue(hiddenGeometry(dialog));
animation->setDuration(300);
animation->setEasingCurve(QEasingCurve::OutExpo);
animation->start();
connect(animation, &QPropertyAnimation::finished, [=]{
animation->deleteLater();
dialog->close();
dialog->deleteLater();
});
emit dialogClosed();
}
示例2: showGriant
void Notify::showGriant()
{
this->show();
titleLabel->setText(title);
QPixmap tempPix = QPixmap(this->icon);
tempPix = tempPix.scaled(QSize(30, 30), Qt::KeepAspectRatio);
iconLabel->setPixmap(tempPix);
backgroundLabel->setFixedSize(this->size());
closeBtn->move(backgroundLabel->width() - closeBtn->width(), 0);
// 超过长度省略号
QFontMetrics elidfont(bodyLabel->font());
QString text = elidfont.elidedText(this->body, Qt::ElideRight,
bodyLabel->width() - 5);
bodyLabel->setText(text);
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity", this);
animation->setStartValue(0);
animation->setEndValue(1);
animation->setDuration(200);
animation->start();
connect(animation, &QPropertyAnimation::finished, this, [animation, this](){
animation->deleteLater();
QTimer::singleShot(displayTime, this, [this](){
this->hideGriant();
});
});
}
示例3: hideGriant
void Notify::hideGriant()
{
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity", this);
animation->setStartValue(this->windowOpacity());
animation->setEndValue(0);
animation->setDuration(200);
animation->start();
connect(animation, &QPropertyAnimation::finished, this, [animation, this](){
this->hide();
animation->deleteLater();
Q_EMIT disappeared();
});
}
示例4: slotFinished
void KItemListViewAnimation::slotFinished()
{
QPropertyAnimation* finishedAnim = qobject_cast<QPropertyAnimation*>(sender());
for (int type = 0; type < AnimationTypeCount; ++type) {
QMutableHashIterator<QGraphicsWidget*, QPropertyAnimation*> it(m_animation[type]);
while (it.hasNext()) {
it.next();
QPropertyAnimation* propertyAnim = it.value();
if (propertyAnim == finishedAnim) {
QGraphicsWidget* widget = it.key();
it.remove();
finishedAnim->deleteLater();
emit finished(widget, static_cast<AnimationType>(type));
return;
}
}
}
Q_ASSERT(false);
}