构造函数:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
connect(ui.languageBtn, SIGNAL(clicked()), this, SLOT(ClickedLanguage()));//中英文切换
//connect(ui.picinputbtn, SIGNAL(clicked()), this, SLOT(PicinputClicked()));//图像输入
//connect(ui.prebtn, SIGNAL(clicked()), this, SLOT(PrebtnClicked()));//图像预处理
}
中英文字典:(若原本项目用的是英文,则添加个英文字典,把里面涉及到的英文翻译成中文;若用的是中文,则反之)
以本项目为例:(本项目本身是用英文写的,所以应添加英文字典)
第一步:项目中所以涉及显示的英文都改成tr("…")这种格式。
第二步:添加英文字典
点击工具栏的"Qt VS Tools" -> Create New Translation File -> 选择英语 -> 确定 -> 即可得到翻译字典:pro4_en.ts
第三步:更新pro4_en.ts
右击pro4_en.ts -> 点击lupdata
第四步:配置中文
双击进入pro4_en.ts -> 对应每个填写译文:在Translation to American English(United States)中填写对应的中文->