gpt4 book ai didi

c++ - 如何在 Qt 中将 std::string 转换为 QString?

转载 作者:行者123 更新时间:2023-11-30 01:13:27 25 4
gpt4 key购买 nike

<分区>

我正在尝试将一个字符串转换为 QString,以便我可以在 QLineEdit 或 QLabel 上显示该 QString。这是我到目前为止的一段代码

char buff[100];
fgets(buff, sizeof(buff), fp);

//the buff[0] and buff[1] are two char values that I add up to make a string
std::string latitude = std::string() + buff[0] + buff[1];
QString::fromStdString(latitude);

this->ui->lineEdit->setText(latitude);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com