当前位置: 首页>>代码示例>>C++>>正文


C++ QPropertyAnimation::deleteLater方法代码示例

本文整理汇总了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();
}
开发者ID:lbproductions,项目名称:LBGui,代码行数:26,代码来源:dialogcontroller.cpp

示例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();
        });
    });
}
开发者ID:Jinxiaohai,项目名称:QT,代码行数:31,代码来源:notify.cpp

示例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();
    });
}
开发者ID:Jinxiaohai,项目名称:QT,代码行数:14,代码来源:notify.cpp

示例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);
}
开发者ID:stream009,项目名称:dolphin,代码行数:20,代码来源:kitemlistviewanimation.cpp


注:本文中的QPropertyAnimation::deleteLater方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。