Skip to content

Commit efea685

Browse files
committed
fix: Fix the issue where the input box cannot lose focus
Fix the issue where the input box cannot lose focus Log: Fix the issue where the input box cannot lose focus
1 parent 385d501 commit efea685

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/source/page/compresssettingpage.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,3 +1087,30 @@ TypeLabel *CompressSettingPage::getClickLbl() const
10871087
// qDebug() << "getClickLbl called";
10881088
return m_pClickLbl;
10891089
}
1090+
1091+
void CompressSettingPage::mousePressEvent(QMouseEvent *event)
1092+
{
1093+
// 点击空白区域时,清除输入框焦点
1094+
if (m_pFileNameEdt && m_pFileNameEdt->lineEdit()->hasFocus()) {
1095+
qDebug() << "Clearing focus from file name edit";
1096+
m_pFileNameEdt->lineEdit()->clearFocus();
1097+
}
1098+
if (m_pSavePathEdt && m_pSavePathEdt->lineEdit()->hasFocus()) {
1099+
qDebug() << "Clearing focus from save path edit";
1100+
m_pSavePathEdt->lineEdit()->clearFocus();
1101+
}
1102+
if (m_pPasswordEdt && m_pPasswordEdt->lineEdit()->hasFocus()) {
1103+
qDebug() << "Clearing focus from password edit";
1104+
m_pPasswordEdt->lineEdit()->clearFocus();
1105+
}
1106+
if (m_pSplitValueEdt && m_pSplitValueEdt->hasFocus()) {
1107+
qDebug() << "Clearing focus from split value edit";
1108+
m_pSplitValueEdt->clearFocus();
1109+
}
1110+
if (m_pCommentEdt && m_pCommentEdt->hasFocus()) {
1111+
qDebug() << "Clearing focus from comment edit";
1112+
m_pCommentEdt->clearFocus();
1113+
}
1114+
1115+
DWidget::mousePressEvent(event);
1116+
}

src/source/page/compresssettingpage.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,26 @@ class CompressSettingPage : public DWidget
7676
*/
7777
QString getComment() const;
7878

79+
/**
80+
* @brief 是否定制模式
81+
* @return
82+
*/
83+
bool isOrderMode();
84+
7985
/**
8086
* @brief eventFilter 事件过滤,处理键盘事件等
8187
* @param watched
8288
* @param event
8389
* @return
8490
*/
8591
bool eventFilter(QObject *watched, QEvent *event) override;
92+
93+
protected:
8694
/**
87-
* @brief 是否定制模式
88-
* @return
95+
* @brief mousePressEvent 鼠标点击事件,点击空白区域取消输入框焦点
96+
* @param event
8997
*/
90-
bool isOrderMode();
91-
98+
void mousePressEvent(QMouseEvent *event) override;
9299
private:
93100
/**
94101
* @brief initUI 初始化界面

0 commit comments

Comments
 (0)