Skip to content

Instantly share code, notes, and snippets.

@fernandoc1
Created January 25, 2019 14:36
Show Gist options
  • Save fernandoc1/49565c64057e1982898a8f7ed23013a5 to your computer and use it in GitHub Desktop.
Save fernandoc1/49565c64057e1982898a8f7ed23013a5 to your computer and use it in GitHub Desktop.
QProcess::finished with lambda function example.
#include <QCoreApplication>
#include <QtGlobal>
#include <QDebug>
#include "global_settings.hpp"
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
GlobalSettings::loadConfig("config.json");
QJsonValue scriptPath = GlobalSettings::value("get_inspection_analysis_images_path");
QString scriptPathStr = scriptPath.toString();
QStringList args;
args << scriptPathStr;
QProcess process;
process.start("/usr/bin/php", args);
QObject::connect(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
[=](int exitCode, QProcess::ExitStatus exitStatus)
{
qInfo() << "OK";
});
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment