[英]How to use QTableWidgetItem text to translate a language translation in QT
QTableWidget* table = new QTableWidget();
QTableWidgetItem *tw_1 = new QTableWidgetItem();
tw_1->setText(QObject::tr("Table Name"));
table->setItem(0,0, tw_1);
ru.ts file ru.ts文件
<context>
<name>QTableWidgetItem</name>
<message>
<source>Table Name</source>
<translation>Название таблицы</translation>
</message>
</context>
Language translation is not working in QTableWidgetItem.. How to use tranlation here.. 语言翻译在QTableWidgetItem中不起作用。如何在此处使用翻译。
You use QObject::tr("Table Name")
and then you should specify QObject
in ru.ts file. 您使用
QObject::tr("Table Name")
,然后应在ru.ts文件中指定QObject
。
<context>
<name>QObject</name>
<message>
<source>Table Name</source>
<translation>Название таблицы</translation>
</message>
</context>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.