本文整理汇总了C++中Pose::setTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ Pose::setTarget方法的具体用法?C++ Pose::setTarget怎么用?C++ Pose::setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pose
的用法示例。
在下文中一共展示了Pose::setTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadProject
void PoseEditor::loadProject() {
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QDir::currentPath(), tr("rcss3dPoseProject : ppj (*.ppj);;AllFiles(*.*)"));
if(filename.isEmpty()) {
qDebug() << "PoseEditor:loadProject : filename is empty";
return;
}
if(!filename.endsWith(".ppj")) {
qDebug() << "PoseEditor:loadProject : file type isn't \"ppj\"";
return;
}
std::ifstream ifs(filename.toStdString().c_str());
std::string str;
while(std::getline(ifs, str)) { // for all line in file
std::vector<std::string> splitLine;
boost::algorithm::split(splitLine, str, boost::is_any_of("\t"));
/*
for(std::vector<std::string>::iterator it = splitLine.begin(); it != splitLine.end(); it++){
std::cout << *it << ":";
}
std::cout << std::endl;
*/
std::vector<std::string>::iterator it = splitLine.begin();
if(*it == "pose") {
it++;
int i = boost::lexical_cast<int>(*it);
it++;
if(*it == "name") {
it++;
std::string nameStr = *it;
QString nameQStr(nameStr.c_str());
posesList->item(i)->setText(nameQStr);
} else if(*it == "gain") {
it++;
double gain = boost::lexical_cast<double>(*it);
Pose p = posesList->item(i)->data(Qt::UserRole).value<Pose>();
p.setGain(gain);
posesList->item(i)->setData(Qt::UserRole, QVariant::fromValue(p));
} else if(*it == "joint") {
it++;
int jointNum = boost::lexical_cast<int>(*it);
it++;
double target = boost::lexical_cast<double>(*it);
Pose p = posesList->item(i)->data(Qt::UserRole).value<Pose>();
p.setTarget(jointNum, target);
posesList->item(i)->setData(Qt::UserRole, QVariant::fromValue(p));
// posesList->item(i)->data(Qt::UserRole).value<Pose>().setTarget(jointNum, target); // not works
}
}
}
changePoseListRow(posesList->currentRow());
}