Qt窗体ui如何设置中英文翻译?

ui拖入控件label

Qt--菜单栏--View--Widget Box--label--拖入form1.ui

form1.cpp

cpp 复制代码
QString sdata = this->readText("Hi");
this->label->setText(sdata);

chs.ts

cpp 复制代码
<context>
    <name>form1</name>
    <message>
      <source>Hi</source>
      <translation>你好!</translation>
      <chars>10</chars>
    </message>
</context>

eng.ts

cpp 复制代码
<context>
    <name>form1</name>
    <message>
      <source>Hi</source>
      <translation>Hello!</translation>
      <chars>10</chars>
    </message>
</context>
相关推荐
blasit4 天前
笔记:Qt C++建立子线程做一个socket TCP常连接通信
c++·qt·tcp/ip
郑州光合科技余经理9 天前
代码展示:PHP搭建海外版外卖系统源码解析
java·开发语言·前端·后端·系统架构·uni-app·php
feifeigo1239 天前
matlab画图工具
开发语言·matlab
dustcell.9 天前
haproxy七层代理
java·开发语言·前端
norlan_jame9 天前
C-PHY与D-PHY差异
c语言·开发语言
多恩Stone9 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系
开发语言·c++·人工智能·python·算法·3d·aigc
修炼前端秘籍的小帅9 天前
Stitch——Google热门的免费AI UI设计工具
前端·人工智能·ui
QQ4022054969 天前
Python+django+vue3预制菜半成品配菜平台
开发语言·python·django
遥遥江上月9 天前
Node.js + Stagehand + Python 部署
开发语言·python·node.js
王码码20359 天前
Flutter for OpenHarmony:socket_io_client 实时通信的事实标准(Node.js 后端的最佳拍档) 深度解析与鸿蒙适配指南
android·flutter·ui·华为·node.js·harmonyos