本文整理汇总了C++中QProcessEnvironment::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcessEnvironment::clear方法的具体用法?C++ QProcessEnvironment::clear怎么用?C++ QProcessEnvironment::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcessEnvironment
的用法示例。
在下文中一共展示了QProcessEnvironment::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keys
void tst_QProcessEnvironment::keys()
{
QProcessEnvironment e;
QVERIFY(e.isEmpty());
QVERIFY(e.keys().isEmpty());
e.insert("FOO", "bar");
QStringList result = e.keys();
QCOMPARE(result.length(), 1);
QCOMPARE(result.at(0), QString("FOO"));
e.clear();
e.insert("BAZ", "");
result = e.keys();
QCOMPARE(result.at(0), QString("BAZ"));
e.insert("FOO", "bar");
e.insert("A", "bc");
e.insert("HELLO", "World");
result = e.keys();
QCOMPARE(result.length(), 4);
// order is not specified, so use contains()
QVERIFY(result.contains("FOO"));
QVERIFY(result.contains("BAZ"));
QVERIFY(result.contains("A"));
QVERIFY(result.contains("HELLO"));
}
示例2: install
bool Packages::install(QStringList const &packages, QString const &chroot)
{
info.currentPkg=tr("Determining installation order");
// cout << "determining installation order" << endl;
QString cmdline;
FILE *f=fopen("/proc/cmdline", "r");
if(f) {
char buf[1024];
fgets(buf, 1024, f);
fclose(f);
cmdline=buf;
}
info.progress=0;
info.totalprogress=0;
totalpackages=packages.count();
package=0;
rpm=new QProcess(this);
QStringList args;
args << "/bin/rpm" << "-iv";
if(cmdline.contains("nodeps"))
args << "--nodeps" ;
if(cmdline.contains("force"))
args << "--force";
#ifdef TEXTONLY
args << "--excludedocs"
<< "--excludepath"
<< "/usr/share/info"
<< "--excludepath"
<< "/usr/share/man"
<< "--excludepath"
<< "/usr/share/doc"
<< "--excludepath"
<< "/usr/docs"
#endif
args << "--percent";
if(!chroot.isEmpty())
args << "-r" << chroot;
foreach(QString const &pkg, packages)
args << pkg;
connect(rpm, SIGNAL(processExited()), this, SLOT(rpmDone()));
connect(rpm, SIGNAL(readyReadStdout()), this, SLOT(dataStdout()));
connect(rpm, SIGNAL(readyReadStderr()), this, SLOT(dataStderr()));
emit progress(&info);
QProcessEnvironment rpmEnv;
rpmEnv.clear();
rpmEnv.insert("PATH", "/bin:/usr/bin:/sbin:/usr/sbin:" + chroot + "/bin:" + chroot + "/usr/bin:" + chroot + "/sbin:" + chroot + "/usr/sbin");
rpmEnv.insert("HOME", "/tmp");
rpmEnv.insert("USER", "root");
rpmEnv.insert("USERNAME", "root");
rpm->setProcessEnvironment(rpmEnv);
rpm->start("/bin/rpm", args);
_io = new QTextStream(rpm);
return true;
}
示例3: clearAndIsEmpty
void tst_QProcessEnvironment::clearAndIsEmpty()
{
QProcessEnvironment e;
e.insert("FOO", "bar");
QVERIFY(!e.isEmpty());
e.clear();
QVERIFY(e.isEmpty());
}
示例4: insert
void tst_QProcessEnvironment::insert()
{
QProcessEnvironment e;
e.insert("FOO", "bar");
QVERIFY(!e.isEmpty());
QVERIFY(e.contains("FOO"));
QCOMPARE(e.value("FOO"), QString("bar"));
e.remove("FOO");
QVERIFY(!e.contains("FOO"));
QVERIFY(e.value("FOO").isNull());
e.clear();
QVERIFY(!e.contains("FOO"));
}
示例5: sipNoMethod
static PyObject *meth_QProcessEnvironment_clear(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QProcessEnvironment *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QProcessEnvironment, &sipCpp))
{
sipCpp->clear();
Py_INCREF(Py_None);
return Py_None;
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QProcessEnvironment, sipName_clear, doc_QProcessEnvironment_clear);
return NULL;
}