testtrdlg.cpp

来自「这个是从外网下的中英文切换的例子」· C++ 代码 · 共 47 行

CPP
47
字号
#include <QMessageBox>
#include "testTrDlg.h"
#include <QApplication>

testTrDlg::testTrDlg(QWidget * parent):QDialog(parent)
{
	setupUi(this);
	
	connect(engBtn,  SIGNAL(clicked()), this, SLOT(english()));
	connect(chsBtn,  SIGNAL(clicked()), this, SLOT(chinese()));
	connect(loveBtn, SIGNAL(clicked()), this, SLOT(ILoveMyFamily()));
	connect(testBtn, SIGNAL(clicked()), this, SLOT(testTr()));

	translator = new QTranslator(this);
	translator->load("Language_Chn");
	qApp->installTranslator(translator);

	retranslateUi(this);
}

testTrDlg::~testTrDlg()
{

}

void testTrDlg::english()
{
	translator->load("Language_Eng");
	retranslateUi(this);
}

void testTrDlg::chinese()
{
	translator->load("Language_Chn");
	retranslateUi(this);
}

void testTrDlg::ILoveMyFamily()
{
	QMessageBox::information(this, loveBtn->text(), loveBtn->text());
}

void testTrDlg::testTr()
{
	QMessageBox::information(this, testBtn->text(), testBtn->text());
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?