#I9PPA5【需求28549】【次要】【主题制作工坊】字体最大化后,主题包信息弹窗中名称-中文、名称-英文和“安装时设置为系统使用主题”显示不全

This commit is contained in:
like 2024-05-29 16:30:08 +08:00
parent c7f05f4c7c
commit 07948d2062
2 changed files with 30 additions and 2 deletions

View File

@ -70,7 +70,6 @@ void InfoCreateWidget::InitThemeName(){
m_themeNameCNLabel = new QLabel();
m_themeNameCNLineEdit = new QLineEdit();
m_themeNameCNLineEdit->setFixedSize(248,36);
m_themeNameCNLabel->setText(tr("ThemeName-CN"));
m_themeNameCNLabel->setFixedWidth(100);
m_themeNameCNLineEdit->setEchoMode(QLineEdit::Normal);
@ -81,14 +80,29 @@ void InfoCreateWidget::InitThemeName(){
m_themeNameENLabel = new QLabel();
m_themeNameENLineEdit = new QLineEdit();
m_themeNameENLineEdit->setFixedSize(248,36);
m_themeNameENLabel->setText(tr("ThemeName-EN"));
m_themeNameENLabel->setFixedWidth(100);
m_themeNameENLineEdit->setEchoMode(QLineEdit::Normal);
m_themeNameENLayout->addWidget(m_themeNameENLabel);
m_themeNameENLayout->addWidget(m_themeNameENLineEdit);
QFont f(m_themeNameCNLabel->font());
QFontMetrics fm(f);
QString str1= fm.elidedText(tr("ThemeName-CN"), Qt::ElideRight, 100);
QString str2= fm.elidedText(tr("ThemeName-EN"), Qt::ElideRight, 100);
m_themeNameCNLabel->setText(str1);
m_themeNameCNLabel->setToolTip(tr("ThemeName-CN"));
m_themeNameENLabel->setText(str2);
m_themeNameENLabel->setToolTip(tr("ThemeName-EN"));
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
QGSettings *gSetting = new QGSettings("org.ukui.style", QByteArray(), this);
connect(gSetting, &QGSettings::changed, this, [=](const QString &key) {
if ("systemFontSize" == key) {
updateLabelShow();
}
});
}
}
void InfoCreateWidget::InitBuilderInfo(){
@ -728,3 +742,15 @@ void InfoCreateWidget::getFileInfo(const QMap<QString, QVariant> &m_packageInfo)
m_builderMailLineEdit->setText(m_packageInfo.value("key3").toString());
}
void InfoCreateWidget::updateLabelShow()
{
QFont f(m_themeNameCNLabel->font());
QFontMetrics fm(f);
QString str1= fm.elidedText(tr("ThemeName-CN"), Qt::ElideRight, 100);
QString str2= fm.elidedText(tr("ThemeName-EN"), Qt::ElideRight, 100);
m_themeNameCNLabel->setText(str1);
m_themeNameCNLabel->setToolTip(str1);
m_themeNameENLabel->setText(str2);
m_themeNameCNLabel->setToolTip(str2);
}

View File

@ -47,6 +47,8 @@ public:
void createMeson(const QString &m_date);
void getFileInfo(const QMap<QString, QVariant> &m_packageInfo);
void updateLabelShow();
signals:
void readytoSave();
void readytoBuild();