Exemplo n.º 1
0
/*!
    \overload

    Starts the program \a program in a new process. \a program is a
    single string of text containing both the program name and its
    arguments. The arguments are separated by one or more spaces.

    The \a program string can also contain quotes, to ensure that arguments
    containing spaces are correctly supplied to the new process.
*/
bool QProcess::startDetached(const QString &program)
{
    QStringList args = parseCombinedArgString(program);

    QString prog = args.first();
    args.removeFirst();

    return QProcessPrivate::startDetached(prog, args);
}
Exemplo n.º 2
0
/*!
    \overload

    Starts the program \a program in a new process. \a program is a
    single string of text containing both the program name and its
    arguments. The arguments are separated by one or more
    spaces. For example:

    \code
        QProcess process;
        process.start("del /s *.txt");
        // same as process.start("del", QStringList() << "/s" << "*.txt");
        ...
    \endcode

    The \a program string can also contain quotes, to ensure that arguments
    containing spaces are correctly supplied to the new process. For example:

    \code
        QProcess process;
        process.start("dir \"My Documents\"");
    \endcode

    The OpenMode is set to \a mode.
*/
void QProcess::start(const QString &program, OpenMode mode)
{
    QStringList args = parseCombinedArgString(program);

    QString prog = args.first();
    args.removeFirst();

    start(prog, args, mode);
}
Exemplo n.º 3
0
void FlushedProcess::start(const QString & command, QIODevice::OpenMode mode) {
    if (init_error) {
        process.setErrorString(tr(CANNOT_INIT_PROCESS));
        QMetaObject::invokeMethod(this,"error",Qt::QueuedConnection,Q_ARG(UnixProcess::ProcessError,UnixProcess::FailedToStart));
        return;
    }

    m_program = parseCombinedArgString(command).first();
    process.start(command,mode);
}
bool GLDProcessFunc::startProcess(const string &strExe)
{
    list<string> args = parseCombinedArgString(strExe);

    if (args.empty())
    {
        return false;
    }

    string prog = args.front();
    args.pop_front();

    if (!startProcess(prog, args))
    {
        std::wstring ws;
        ws.assign(strExe.begin(), strExe.end());
        ShellExecute(0, L"open", ws.c_str(), NULL, NULL, SW_SHOW);
    }

    return false;
}