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


C++ QProcessEnvironment::clear方法代码示例

本文整理汇总了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"));
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:28,代码来源:tst_qprocessenvironment.cpp

示例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;
}
开发者ID:OpenMandrivaSoftware,项目名称:ark-installer,代码行数:59,代码来源:packages.cpp

示例3: clearAndIsEmpty

void tst_QProcessEnvironment::clearAndIsEmpty()
{
    QProcessEnvironment e;
    e.insert("FOO", "bar");
    QVERIFY(!e.isEmpty());
    e.clear();
    QVERIFY(e.isEmpty());
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:8,代码来源:tst_qprocessenvironment.cpp

示例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"));
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:15,代码来源:tst_qprocessenvironment.cpp

示例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;
}
开发者ID:rff255,项目名称:python-qt5,代码行数:21,代码来源:sipQtCoreQProcessEnvironment.cpp


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