Skip to content

Commit

Permalink
fix:修改了重命名窗口的文件名后缀颜色
Browse files Browse the repository at this point in the history
修改了重命名窗口的文件名后缀颜色,添加了其主题变更的颜色变化

Log: 修复了深色模式下重命名弹窗文字看不清的问题
Bug: https://pms.uniontech.com/bug-view-231485.html
  • Loading branch information
lJxDabab committed Jan 12, 2024
1 parent 3f0608c commit d330e19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libimageviewer/widgets/renamedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "unionimage/imageutils.h"

#include "accessibility/ac-desktop-define.h"

#include <DGuiApplicationHelper>
#include <DMessageBox>
#include <DLabel>
#include <DFontSizeManager>
Expand Down Expand Up @@ -81,6 +81,7 @@ RenameDialog::RenameDialog(const QString &filename, QWidget *parent)
// m_vlayout->setStretch(3, 1);
widet->setLayout(m_vlayout);
// onThemeChanged(dApp->viewerTheme->getCurrentTheme());
onThemeChanged(DGuiApplicationHelper::instance()->themeType());
InitDlg();
m_lineedt->lineEdit()->setFocus();
int Dirlen = /*m_DirPath.size() +*/ 1 + m_labformat->text().size();
Expand All @@ -97,7 +98,6 @@ RenameDialog::RenameDialog(const QString &filename, QWidget *parent)
connect(cancelbtn, &DPushButton::clicked, this, [ = ] {
reject();
});

connect(m_lineedt, &DLineEdit::textChanged, this, [ = ](const QString & arg) {
setCurrentTip();
int len = arg.toLocal8Bit().length();
Expand Down Expand Up @@ -229,6 +229,17 @@ void RenameDialog::slotsFocusChanged(bool onFocus)
m_lineedt->hideAlertMessage();
}
}
void RenameDialog::onThemeChanged(DGuiApplicationHelper::ColorType theme){
QPalette palette;
QColor color;
if (theme == DGuiApplicationHelper::ColorType::DarkType) {
color=QColor(179,179,179);
} else {
color=QColor(77,77,77);
}
palette.setColor(QPalette::WindowText,color);
m_labformat->setPalette(palette);
}

void RenameDialog::slotsUpdate()
{
Expand Down
2 changes: 2 additions & 0 deletions libimageviewer/widgets/renamedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <DPushButton>
#include <DSuggestButton>
#include <DLabel>
#include <DGuiApplicationHelper>

DWIDGET_USE_NAMESPACE
class RenameDialog : public DDialog
Expand All @@ -32,6 +33,7 @@ class RenameDialog : public DDialog
QString geteElidedText(QFont font, QString str, int MaxWidth);
private slots:
void slotsFocusChanged(bool onFocus);
void onThemeChanged(DGuiApplicationHelper::ColorType theme);
public:
void slotsUpdate();
protected:
Expand Down

0 comments on commit d330e19

Please sign in to comment.