本文整理汇总了C++中QProcess::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::deleteLater方法的具体用法?C++ QProcess::deleteLater怎么用?C++ QProcess::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcess
的用法示例。
在下文中一共展示了QProcess::deleteLater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sender
void
CheckDirModel::getFileInfoResult()
{
#ifdef Q_OS_MAC
QProcess* p = qobject_cast< QProcess* >( sender() );
Q_ASSERT( p );
QByteArray res = p->readAll().trimmed();
qDebug() << "Got output from GetFileInfo:" << res;
// 1 means /Volumes is hidden, so we show it while the dialog is visible
if ( res == "1" )
{
// Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel
QProcess* showProcess = new QProcess( this );
qDebug() << "Running SetFile:" << QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath );
showProcess->start( QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath ) );
connect( showProcess, SIGNAL( readyReadStandardError() ), this, SLOT( processErrorOutput() ) );
m_shownVolumes = true;
QTimer::singleShot( 500, this, SLOT( volumeShowFinished() ) );
}
p->terminate();
p->deleteLater();
#endif
}
示例2: ifupFinished
void Installer::ifupFinished(int)
{
QProcess *p = qobject_cast<QProcess*> (sender());
emit networkInterfaceUp();
p->deleteLater();
}
示例3: processFinished
void Discover::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
QProcess *process = static_cast<QProcess*>(sender());
// If the process was killed because guhd is shutting down...we dont't care any more about the result
if (m_aboutToQuit)
return;
// Discovery
if (process == m_discoveryProcess) {
qCDebug(dcWallbe()) << "Discovery process finished";
process->deleteLater();
m_discoveryProcess = 0;
QList<DeviceDescriptor> deviceDescriptors;
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
qCWarning(dcWallbe()) << "Network scan error:" << process->readAllStandardError();
emit devicesDiscovered(deviceDescriptors);
return;
}
QByteArray outputData = process->readAllStandardOutput();
foreach (const Host &host, parseProcessOutput(outputData)) {
DeviceDescriptor descriptor(wallbeEcoDeviceClassId, host.hostName(), host.address());
descriptor.setParams( ParamList() << Param(wallbeEcoIpParamTypeId, host.address()));
deviceDescriptors.append(descriptor);
}
示例4: processFinished
void DevicePluginWifiDetector::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
QProcess *p = static_cast<QProcess*>(sender());
p->deleteLater();
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
qCWarning(dcWifiDetector) << "error performing network scan:" << p->readAllStandardError();
return;
}
QList<Device*> watchedDevices = deviceManager()->findConfiguredDevices(supportedDevices().first().id());
if (watchedDevices.isEmpty()) {
return;
}
QStringList foundDevices;
while(p->canReadLine()) {
QString result = QString::fromLatin1(p->readLine());
if (result.startsWith("MAC Address:")) {
QStringList lineParts = result.split(' ');
if (lineParts.count() > 3) {
QString addr = lineParts.at(2);
foundDevices << addr.toLower();
}
}
}
foreach (Device *device, watchedDevices) {
bool wasInRange = device->stateValue(inRangeStateTypeId).toBool();
bool wasFound = foundDevices.contains(device->paramValue("mac").toString().toLower());
if (wasInRange != wasFound) {
device->setStateValue(inRangeStateTypeId, wasFound);
}
}
示例5: GetError
void UbuntuUnityHack::GetError() {
QProcess* get = qobject_cast<QProcess*>(sender());
if (!get) {
return;
}
get->deleteLater();
}
示例6: OpenFolderNautilus
void StaticHelpers::OpenFolderNautilus(QString& file)
{
QProcess* nautilus = new QProcess();
QStringList arguments;
arguments << "--browser" << file;
nautilus->startDetached("nautilus", arguments);
nautilus->deleteLater();
}
示例7: ubuntu_unity_hack_getError
void SysTray::ubuntu_unity_hack_getError()
{
QProcess* get = qobject_cast<QProcess*>(sender());
if (!get)
return;
get->deleteLater();
}
示例8: terminateGpgProcess
void ItemEncryptedLoader::terminateGpgProcess()
{
if (m_gpgProcess == nullptr)
return;
QProcess *p = m_gpgProcess;
m_gpgProcess = nullptr;
p->terminate();
p->waitForFinished();
p->deleteLater();
m_gpgProcessStatus = GpgNotRunning;
updateUi();
}
示例9: exportResults
bool ResultsExporter::exportResults()
{
ResultsExporterSettings ss = settings();
if(!QDir().mkpath(ss.exportDir())) {
qfError() << "Cannot create export dir:" << ss.exportDir();
return false;
}
qfInfo() << "ResultsExporter export dir:" << ss.exportDir();
if(ss.outputFormat() == static_cast<int>(ResultsExporterSettings::OutputFormat::CSOS)) {
int current_stage = eventPlugin()->currentStageId();
QString fn = ss.exportDir() + "/results-csos.txt";
runsPlugin()->exportResultsCsosStage(current_stage, fn);
return true;
}
if(ss.outputFormat() == static_cast<int>(ResultsExporterSettings::OutputFormat::IofXml3)) {
int current_stage = eventPlugin()->currentStageId();
QString fn = ss.exportDir() + "/results-csos.txt";
runsPlugin()->exportResultsIofXml30Stage(current_stage, fn);
return true;
}
else if(ss.outputFormat() == static_cast<int>(ResultsExporterSettings::OutputFormat::HtmlMulti)) {
quickevent::core::exporters::StageResultsHtmlExporter exp;
exp.setOutDir(ss.exportDir());
exp.generateHtml();
QString cmd = ss.whenFinishedRunCmd();
if(!cmd.isEmpty()) {
qfInfo() << "Starting process:" << cmd;
QProcess *proc = new QProcess();
connect(proc, &QProcess::readyReadStandardOutput, [proc]() {
QByteArray ba = proc->readAllStandardOutput();
qfInfo().noquote() << "PROC stdout:" << ba;
});
connect(proc, &QProcess::readyReadStandardError, [proc]() {
QByteArray ba = proc->readAllStandardError();
qfWarning().noquote() << "PROC stderr:" << ba;
});
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [proc](int exit_code, QProcess::ExitStatus exit_status) {
if(exit_status == QProcess::ExitStatus::CrashExit)
qfError() << "PROC crashed";
else
qfInfo() << "PROC finished with exit code:" << exit_code;
proc->deleteLater();
});
proc->start(cmd);
}
return true;
}
qfError() << "Unsupported output format:" << ss.outputFormat();
return false;
}
示例10: QProcess
QProcess *getInterpreterProcess( QString path ) {
QProcess *antProcess;
antProcess = new QProcess( );
antProcess->start( path );
if (!antProcess->waitForStarted()) {
antProcess->deleteLater();
antProcess = NULL;
}
return antProcess;
}
示例11: run
void run() {
QStringList list;
QString text;
QProcess ping;
QStringList result;
QRegExp rx("(\\d+)% loss");
while(true) {
if(window->stop) {
window->stop = false;
window->StartButton->setEnabled(true);
window->StopButton->setEnabled(false);
window->IPInput->setEnabled(true);
break;
}
#ifdef _WIN32
ping.start("ping.exe " + window->IPInput->text() + " -n 10");
#else
ping.start("ping " + window->IPInput->text() + " -c 10");
#endif
ping.waitForFinished();
text = ping.readAll();
if (!text.isEmpty()) {
list = text.split("\n");
if(list.length() < 5) {
window->stop = true;
} else {
result = list.filter("unreachable");
if(result.length() > 0) {
window->stop = true;
} else {
result = list.filter("loss");
if(result.length() > 0) {
if(rx.indexIn(result[0], 0) != -1) {
if(rx.cap(1) == "100") {
window->stop = true;
}
}
}
}
}
}
ping.deleteLater();
}
}
示例12: runAddGateway
//------------------------------------------------------------------------------------------------
void Window::runAddGateway(QString gw)
{
QProcess *route = new QProcess(this);
QString program = "route";
QStringList arguments;
#ifdef Q_OS_WIN
arguments << "add" << "0.0.0.0" << "mask" << "0.0.0.0" << gw;
#endif
route->start(program, arguments);
route->waitForFinished();
// start ping every 2 seconds
pingTimer->start(2000);
QString tooltip;
if (route->exitCode() == 0)
{
if (showBalloons->isChecked())
trayIcon->showMessage(tr("Current gateway:"), gw, QSystemTrayIcon::Information, 5000);
routeError.clear();
currentGw = gw;
tooltip = tr("Gateway:") + " " + currentGw;
gwInfo->setText(tr("Current gateway: ") + "<b>" + currentGw + "</b>");
}
else
{
if (showBalloons->isChecked())
trayIcon->showMessage(tr("Cannot switch gateway"), tr("Press here for additional information"), QSystemTrayIcon::Critical, 5000);
#ifdef Q_OS_WIN
QByteArray ba = route->readAllStandardError();
QTextCodec *codec = QTextCodec::codecForName("IBM866");
routeError = codec->toUnicode(ba);
#else
routeError = route->readAllStandardError();
#endif
tooltip = tr("Gateway: none");
gwInfo->setText(tr("Current gateway: ") + "<b>" + tr("none") + "</b>");
}
trayIcon->setToolTip(tooltip);
route->deleteLater();
}
示例13: sender
void
CheckDirModel::getFileInfoResult()
{
#ifdef Q_WS_MAC
QProcess* p = qobject_cast< QProcess* >( sender() );
Q_ASSERT( p );
QByteArray res = p->readAll().trimmed();
// 1 means /Volumes is hidden, so we show it while the dialog is visible
if ( res == "1" )
{
// Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel
QProcess::startDetached( QString( "SetFile -a v %1" ).arg( s_macVolumePath ) );
m_shownVolumes = true;
}
p->deleteLater();
#endif
}
示例14: qmlPluginTypeDumpError
void PluginDumper::qmlPluginTypeDumpError(QProcess::ProcessError)
{
QProcess *process = qobject_cast<QProcess *>(sender());
if (!process)
return;
process->deleteLater();
const QString libraryPath = m_runningQmldumps.take(process);
Core::MessageManager *messageManager = Core::MessageManager::instance();
const QString errorMessages = process->readAllStandardError();
messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, errorMessages));
if (!libraryPath.isEmpty()) {
const Snapshot snapshot = m_modelManager->snapshot();
LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(errorMessages));
m_modelManager->updateLibraryInfo(libraryPath, libraryInfo);
}
}
示例15: serverFinish
void ServerManager::serverFinish(int exitCode, QProcess::ExitStatus exitStatus)
{
QProcess *server = qobject_cast<QProcess *>(sender());
if (server) {
//server->close(); // long blocking..
server->deleteLater();
int id = serversStatus.take(server);
if (isRunning()) {
if (exitCode != 127) { // 127 : for auto reloading
tSystemError("Detected a server crashed. exitCode:%d exitStatus:%d", exitCode, (int)exitStatus);
}
startServer(id);
} else {
tSystemDebug("Detected normal exit of server. exitCode:%d", exitCode);
if (serversStatus.count() == 0) {
Tf::app()->exit(-1);
}
}
}
}