linux 下读取default.yaml文件(utf-8),显示在QT界面上。
yfowd: 前
ybkwd: 后
yleft: 左
yright: 右
yup: 上
ydown: 下
void MainWindow::get_yaml_vars()
{
// return;
// std::cout<<__LINE__<<std::endl;
YAML::Node config = YAML::LoadFile("/home/pcl/AuvRace/src/qdude/language/default.yaml");
// std::cout<<__LINE__<<std::endl;
std::string tmps = config["yfowd"].as<std::string>();
// std::cout<<__LINE__<<std::endl;
//fromUtf8
ui.btnFw->setText(QString::fromUtf8(tmps.c_str()));
tmps = config["ybkwd"].as<std::string>();
std::cout<<tmps<<std::endl;
ui.btnBk->setText(QString::fromUtf8(tmps.c_str()));
}