本文整理汇总了C++中Transfer::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ Transfer::deleteLater方法的具体用法?C++ Transfer::deleteLater怎么用?C++ Transfer::deleteLater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transfer
的用法示例。
在下文中一共展示了Transfer::deleteLater方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transferFinished
void Updater::transferFinished()
{
Transfer *transfer = qobject_cast<Transfer*>(sender());
if (transfer)
{
const QString path = transfer->getTarget();
if ((transfer->getState() == Transfer::FinishedState) && QFile::exists(path))
{
if (QFileInfo(path).suffix() == QLatin1String("xml"))
{
QFile file(SessionsManager::getWritableDataPath(QLatin1String("update.txt")));
if (file.open(QIODevice::ReadWrite | QIODevice::Text))
{
QTextStream stream(&file);
stream << path;
file.close();
}
}
}
else
{
Console::addMessage(QCoreApplication::translate("main", "Unable to download update: %1\nError: %2").arg(transfer->getSource().url()).arg(transfer->getState()), OtherMessageCategory, ErrorMessageLevel);
m_transfersSuccessful = false;
}
transfer->deleteLater();
}
else
{
m_transfersSuccessful = false;
}
++m_transfersCount;
if (m_transfersCount == 2)
{
if (!m_transfersSuccessful)
{
clearUpdate();
}
emit finished(m_transfersSuccessful);
deleteLater();
}
}
示例2: startTransfer
Transfer* TransfersManager::startTransfer(QNetworkReply *reply, const QString &target, Transfer::TransferOptions options)
{
Transfer *transfer = new Transfer(reply, target, options, m_instance);
if (transfer->getState() == Transfer::CancelledState)
{
transfer->deleteLater();
return NULL;
}
addTransfer(transfer);
return transfer;
}