当前位置: 首页>>代码示例>>C++>>正文


C++ QProcess::systemEnvironment方法代码示例

本文整理汇总了C++中QProcess::systemEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::systemEnvironment方法的具体用法?C++ QProcess::systemEnvironment怎么用?C++ QProcess::systemEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QProcess的用法示例。


在下文中一共展示了QProcess::systemEnvironment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getGSLinuxPath

QString getGSLinuxPath( QString apps  )
{
    QStringList potential_paths;
    potential_paths.append("/usr/local/bin");
    potential_paths.append("/sw/bin");   /* to use on mac as same */
    potential_paths.append("/opt/bin");
    QProcess *process = new QProcess(NULL);
    process->setReadChannelMode(QProcess::MergedChannels);
    QStringList env = process->systemEnvironment();
    env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;"+potential_paths.join(";"));
    process->setEnvironment(env);
    
        process->start( QString("which") ,  QStringList() << apps , QIODevice::ReadOnly );
          if (!process->waitForFinished()) {
          return QString();
          } else {
              QString finder = process->readAll().trimmed();
              if (finder.endsWith(apps,Qt::CaseInsensitive)) {
                 ///////////// qDebug() << "### finder " <<  finder;
                return finder;  
              } else {
                return QString(); 
              }
          }
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:25,代码来源:scribemime.cpp

示例2: callMaddeShellScript

bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
    const QString &qmakePath, const QString &command, const QStringList &args,
    bool useTarget)
{
    if (!QFileInfo(command).exists())
        return false;
    QString actualCommand = command;
    QStringList actualArgs = targetArgs(qmakePath, useTarget) + args;
    Environment env(proc.systemEnvironment());
    addMaddeEnvironment(env, qmakePath);
    proc.setEnvironment(env.toStringList());
    transformMaddeCall(actualCommand, actualArgs, qmakePath);
    proc.start(actualCommand, actualArgs);
    return true;
}
开发者ID:syntheticpp,项目名称:qt-creator,代码行数:15,代码来源:maemoglobal.cpp

示例3: PackageInfo

PackageInfo
UpdateProcess::packageInfo(const QString &package)
{
  QProcess proc;
  QStringList args;

  args << "json2xml"
       << QDir::convertSeparators(updateRepositoryDir() + "/" + package);

  vNotice("updater: launching auto-update executable: %1 %2")
                                           .arg(updateExecutable())
                                           .arg(args.join(" "));

  proc.setEnvironment(proc.systemEnvironment());
  proc.start(updateExecutable(), args);
  if (! proc.waitForStarted())
    return PackageInfo();
  if (! proc.waitForFinished())
    return PackageInfo();
  return packageInfoFromXml(proc.readAll());
}
开发者ID:Bodyfarm,项目名称:vidalia,代码行数:21,代码来源:UpdateProcess.cpp

示例4: pageRequestedEvent

/*!
 * \reimp
 */
void QxtWebCgiService::pageRequestedEvent(QxtWebRequestEvent* event)
{
    // Create the process object and initialize connections
    QProcess* process = new QProcess(this);
    qxt_d().requests[process] = QxtCgiRequestInfo(event);
    qxt_d().processes[event->content] = process;
    QxtCgiRequestInfo& requestInfo = qxt_d().requests[process];
    QObject::connect(process, SIGNAL(readyRead()), &qxt_d(), SLOT(processReadyRead()));
    QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), &qxt_d(), SLOT(processFinished()));
    QObject::connect(process, SIGNAL(error(QProcess::ProcessError)), &qxt_d(), SLOT(processFinished()));
    requestInfo.timeout = new QTimer(process);
    qxt_d().timeoutMapper.setMapping(requestInfo.timeout, process);
    QObject::connect(requestInfo.timeout, SIGNAL(timeout()), &qxt_d().timeoutMapper, SLOT(map()));

    // Initialize the system environment
    QStringList s_env = process->systemEnvironment();
    QMap<QString, QString> env;
    foreach(const QString& entry, s_env)
    {
        int pos = entry.indexOf('=');
        env[entry.left(pos)] = entry.mid(pos + 1);
    }
开发者ID:R4md4c,项目名称:tomahawk,代码行数:25,代码来源:qxtwebcgiservice.cpp


注:本文中的QProcess::systemEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。