kklp
2021-12-15 15:19
采纳率: 100%
浏览 131

Qt指针释放问题-QTimer

下面这个构造函数执行完,QTimer会自动释放吗?


CDisapperWgt::CDisapperWgt()
{
QTimer* burnTime = new QTimer(this);
    burnTime->start(300);
    burnTime->setSingleShot(true);
    connect(burnTime, &QTimer::timeout, this,
        [this]() {
            setWindowOpacity(0.8);
            QTimer* hideTime = new QTimer(this);
            hideTime->start(1200);
            hideTime->setSingleShot(true);
            connect(hideTime, &QTimer::timeout, this,
                [this]() {
                    close();
                }
            );
        });
}

3条回答 默认 最新

相关推荐 更多相似问题