本文整理汇总了C++中QLCInputProfile::saveXML方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCInputProfile::saveXML方法的具体用法?C++ QLCInputProfile::saveXML怎么用?C++ QLCInputProfile::saveXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCInputProfile
的用法示例。
在下文中一共展示了QLCInputProfile::saveXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void QLCInputProfile_Test::save()
{
QLCInputProfile ip;
ip.setManufacturer("TestManufacturer");
ip.setModel("TestModel");
QLCInputChannel* ich1 = new QLCInputChannel();
ich1->setName("Channel 1");
ip.insertChannel(0, ich1);
QLCInputChannel* ich2 = new QLCInputChannel();
ich2->setName("Channel 2");
ip.insertChannel(5, ich2);
QLCInputChannel* ich3 = new QLCInputChannel();
ich3->setName("Channel 3");
ip.insertChannel(2, ich3);
QString path("test.qxi");
QVERIFY(ip.saveXML(path) == true);
#if !defined(WIN32) && !defined(Q_OS_WIN)
QFile::Permissions perm = QFile::permissions(path);
QFile::setPermissions(path, 0);
QVERIFY(ip.saveXML(path) == false);
QFile::setPermissions(path, perm);
#endif
QLCInputProfile* prof = QLCInputProfile::loader(path);
QVERIFY(prof != NULL);
QCOMPARE(prof->manufacturer(), ip.manufacturer());
QCOMPARE(prof->model(), ip.model());
QCOMPARE(prof->name(), ip.name());
QCOMPARE(prof->channels().size(), ip.channels().size());
QCOMPARE(prof->channels()[0]->name(), ich1->name());
QCOMPARE(prof->channels()[2]->name(), ich3->name());
QCOMPARE(prof->channels()[5]->name(), ich2->name());
QVERIFY(QFile::remove(path) == true);
delete prof;
}