QTranslator使用整理
来源:互联网 发布:linux snmp 监控cpu 编辑:程序博客网 时间:2024/05/19 09:48
效果图
源码
QTranslator *translator = new QTranslator; translator->load("../TestHello/TestHello.qm"); a.installTranslator(translator); MainWindow w; w.show();
testHello.ts内容
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE TS><TS version="2.1" language="zh_CN"><context> <name>MainWindow</name> <message> <location filename="mainwindow.ui" line="14"/> <source>MainWindow</source> <translation>主窗口</translation> </message> <message> <location filename="mainwindow.ui" line="27"/> <source>hello</source> <translation>你好</translation> </message> <message> <location filename="mainwindow.ui" line="40"/> <source>china</source> <translation>中国</translation> </message></context></TS>
mainwindow.ui
<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> <widget class="QPushButton" name="pushButton"> <property name="geometry"> <rect> <x>70</x> <y>110</y> <width>75</width> <height>23</height> </rect> </property> <property name="text"> <string>hello</string> </property> </widget> <widget class="QPushButton" name="pushButton_2"> <property name="geometry"> <rect> <x>230</x> <y>110</y> <width>75</width> <height>23</height> </rect> </property> <property name="text"> <string>china</string> </property> </widget> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>19</height> </rect> </property> </widget> <widget class="QToolBar" name="mainToolBar"> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> <bool>false</bool> </attribute> </widget> <widget class="QStatusBar" name="statusBar"/> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> <connections/></ui>
阅读全文
0 0
- QTranslator使用整理
- QTranslator的使用
- QT QTranslator的使用
- Qt国际化之QTranslator的使用
- qt使用QTranslator QObject::tr(“”)软件国际化
- 关于QT的软件翻译QTranslator
- EXISTS的使用(整理)
- mysql使用心得整理
- solr使用整理
- ant使用整理
- sh脚本使用整理
- Dozer使用 整理
- Dozer使用 整理2
- FCKEditor 使用整理
- Wix使用整理(一)
- Wix使用整理(二)
- Wix使用整理(三)
- Wix使用整理(四)
- A. Sasha and Sticks
- HPU2017-栈和队列练习
- 扩展阅读 八面玲珑
- C
- CF827B:High Load(树 & 构造)
- QTranslator使用整理
- memcpy函数实现
- 设置zookeeper开机自启动
- MPTCP
- 欢迎使用CSDN-markdown编辑器
- Mark一下
- poj2236Wireless Network之并查集解法
- 使用jenkins、docker、consul、nginx搭建支持自动化构建部署以及弹性伸缩的集群系统详细教程
- OGG-02091 错误解决办法