加载qtbase翻译文件

This commit is contained in:
jzxc95 2021-12-07 09:25:30 +08:00
parent ea753d25f5
commit e8211f4a68
7 changed files with 12 additions and 13 deletions

View File

@ -69,13 +69,6 @@ public:
KyEapMethodTtlsInfo ttlsInfo;
};
static void setLineEditMenuPolicy(QFrame *widget) {
QList<QLineEdit *> lineEditList = widget->findChildren<QLineEdit *>();
for (int i = 0; i < lineEditList.count(); ++i) {
lineEditList.at(i)->setContextMenuPolicy(Qt::NoContextMenu);
}
}
static void setFramePalette(QFrame *widget, QPalette &pal) {
QList<QLineEdit *> lineEditList = widget->findChildren<QLineEdit *>();
for (int i = 0; i < lineEditList.count(); ++i) {

View File

@ -7,8 +7,6 @@ CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent)
{
initUI();
initComponent();
QList<QLineEdit *> lineEditList = this->findChildren<QLineEdit *>();
setLineEditMenuPolicy(this);
}
void CreatNetPage::initUI()

View File

@ -12,7 +12,6 @@ DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent)
this->setFrameShape(QFrame::Shape::StyledPanel);
this->setMaximumWidth(960);
initUI();
setLineEditMenuPolicy(this);
if (isCreate) {
connect(mSSIDEdit, &QLineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn);
}

View File

@ -6,7 +6,6 @@ Ipv4Page::Ipv4Page(QWidget *parent):QFrame(parent)
{
initUI();
initComponent();
setLineEditMenuPolicy(this);
}
void Ipv4Page::initUI() {

View File

@ -5,7 +5,6 @@ Ipv6Page::Ipv6Page(QWidget *parent):QFrame(parent)
{
initUI();
initComponent();
setLineEditMenuPolicy(this);
}
void Ipv6Page::setIpv6Config(KyIpConfigType ipv6Config)

View File

@ -7,7 +7,6 @@ SecurityPage::SecurityPage(QWidget *parent) : QFrame(parent)
{
initUI();
initConnect();
setLineEditMenuPolicy(this);
}
void SecurityPage::initUI()

View File

@ -31,6 +31,8 @@
#define LOG_IDENT "ukui_kylin_nm"
const QString QT_TRANSLATE_FILE = "/usr/share/qt5/translations/qt_zh_CN.qm";
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
@ -109,6 +111,16 @@ int main(int argc, char *argv[])
qWarning() << "Translations load fail";
}
QTranslator qtBaseTranslator;
qtBaseTranslator.load(QT_TRANSLATE_FILE);
if (qtBaseTranslator.load(QT_TRANSLATE_FILE))
{
a.installTranslator(&qtBaseTranslator);
qDebug()<<"QtBase Translations load success";
} else {
qWarning() << "QtBase Translations load fail";
}
while (!p_networkResource->NetworkManagerIsInited()) {
::usleep(1000);
}