diff --git a/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.cpp b/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.cpp index c78385d430..7c5d521a57 100644 --- a/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.cpp +++ b/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.cpp @@ -13,6 +13,9 @@ #include #include #include +#ifdef DTKWIDGET_CLASS_DSizeMode +# include +#endif #include #include @@ -36,11 +39,8 @@ VaultActiveSetUnlockMethodView::VaultActiveSetUnlockMethodView(QWidget *parent) void VaultActiveSetUnlockMethodView::initUi() { - DLabel *pLabel = new DLabel(tr("Set Vault Password"), this); - QFont font = pLabel->font(); - font.setPixelSize(18); - pLabel->setFont(font); - pLabel->setAlignment(Qt::AlignHCenter); + titleLabel = new DLabel(tr("Set Vault Password"), this); + titleLabel->setAlignment(Qt::AlignHCenter); DLabel *pTypeLabel = new DLabel(tr("Encryption method"), this); typeCombo = new DComboBox(this); @@ -100,14 +100,16 @@ void VaultActiveSetUnlockMethodView::initUi() QVBoxLayout *play = new QVBoxLayout(this); play->setMargin(0); - play->addWidget(pLabel); + play->addWidget(titleLabel); play->addSpacing(15); play->addLayout(gridLayout); play->addStretch(); play->addWidget(nextBtn); + initUiForSizeMode(); + #ifdef ENABLE_TESTING - AddATTag(qobject_cast(pLabel), AcName::kAcLabelVaultSetUnlockTitle); + AddATTag(qobject_cast(titleLabel), AcName::kAcLabelVaultSetUnlockTitle); AddATTag(qobject_cast(pTypeLabel), AcName::kAcLabelVaultSetUnlcokMethod); AddATTag(qobject_cast(typeCombo), AcName::kAcComboVaultSetUnlockMethod); AddATTag(qobject_cast(passwordLabel), AcName::kAcLabelVaultSetUnlockPassword); @@ -121,6 +123,19 @@ void VaultActiveSetUnlockMethodView::initUi() #endif } +void VaultActiveSetUnlockMethodView::initUiForSizeMode() +{ +#ifdef DTKWIDGET_CLASS_DSizeMode + QFont font = titleLabel->font(); + font.setPixelSize(DSizeModeHelper::element(13, 16)); + titleLabel->setFont(font); +#else + QFont font = titleLabel->font(); + font.setPixelSize(15); + titleLabel->setFont(font); +#endif +} + void VaultActiveSetUnlockMethodView::initConnect() { connect(typeCombo, SIGNAL(currentIndexChanged(int)), @@ -143,6 +158,12 @@ void VaultActiveSetUnlockMethodView::initConnect() this, &VaultActiveSetUnlockMethodView::slotRepeatPasswordEditFocusChanged); connect(nextBtn, &DPushButton::clicked, this, &VaultActiveSetUnlockMethodView::slotNextBtnClicked); + +#ifdef DTKWIDGET_CLASS_DSizeMode + connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [this]() { + initUiForSizeMode(); + }); +#endif } void VaultActiveSetUnlockMethodView::clearText() diff --git a/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.h b/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.h index 9731a5ddb2..ba26aa64e6 100644 --- a/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.h +++ b/src/plugins/filemanager/dfmplugin-vault/views/createvaultview/vaultactivesetunlockmethodview.h @@ -61,6 +61,7 @@ private slots: private: void initUi(); + void initUiForSizeMode(); void initConnect(); //! 校验密码是否符合规则 bool checkPassword(const QString &passwordEdit); @@ -71,6 +72,7 @@ private slots: void showEvent(QShowEvent *event) override; private: + DTK_WIDGET_NAMESPACE::DLabel *titleLabel { nullptr }; DTK_WIDGET_NAMESPACE::DComboBox *typeCombo { nullptr }; DTK_WIDGET_NAMESPACE::DLabel *passwordLabel { nullptr };