Skip to content

Commit

Permalink
fix: Resolve the issue of being able to close alt+F4 when importing p…
Browse files Browse the repository at this point in the history
…rogress bars

  Resolve the issue of being able to close alt+F4 when importing progress bars

Log: Resolve the issue of being able to close alt+F4 when importing progress bars
Bug: https://pms.uniontech.com/bug-view-232643.html
  • Loading branch information
starhcq committed Dec 6, 2023
1 parent 2ba4c6f commit a9bee30
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
22 changes: 17 additions & 5 deletions src/album/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ const int ALBUMBTN_NORMAL_WIDTH = 90;

}//namespace

void DDialogEx::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape)
return;

DDialog::keyPressEvent(event);
}

void DDialogEx::closeEvent(QCloseEvent *event)
{
event->ignore();
}

using namespace utils::common;
MainWindow::MainWindow()
: m_iCurrentView(VIEW_ALLPIC)
Expand Down Expand Up @@ -269,10 +282,9 @@ void MainWindow::initUI()
//初始化等待窗口
void MainWindow::initWaitDialog()
{
m_waitdailog = new DDialog(this);

m_waitdailog->setCloseButtonVisible(false);
m_waitdailog->setWindowModality(Qt::WindowModal);
m_waitdailog = new DDialogEx(this);
m_waitdailog->setWindowFlag(Qt::WindowCloseButtonHint, false);
m_waitdailog->setModal(true);
m_waitdailog->setFixedSize(QSize(480, 93));

m_waitlabel = new DLabel(m_waitdailog);
Expand Down Expand Up @@ -2283,7 +2295,7 @@ void MainWindow::onCloseWaitDialog()
{
m_progressType = Progress_Unknown;
m_countLabel->setText("");
m_waitdailog->close();
m_waitdailog->hide();
}

void MainWindow::onImagesRemoved()
Expand Down
15 changes: 14 additions & 1 deletion src/album/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ extern bool bfirstandviewimage;

class QShortcut;

class DDialogEx : public DDialog
{
Q_OBJECT

public:
explicit DDialogEx(QWidget *parent = nullptr): DDialog (parent) {};
~DDialogEx() {};

protected:
void keyPressEvent(QKeyEvent *event) override;
void closeEvent(QCloseEvent *event) override;
};

class MainWindow : public DMainWindow, public ImageEngineImportObject
{
Q_OBJECT
Expand Down Expand Up @@ -236,7 +249,7 @@ public slots:
FlatButton *m_pTimeBtn = nullptr;
FlatButton *m_pAlbumBtn = nullptr;

DDialog *m_waitdailog = nullptr;
DDialogEx *m_waitdailog = nullptr;
DProgressBar *m_importBar = nullptr;
DLabel *m_waitlabel = nullptr;
DLabel *m_countLabel = nullptr;
Expand Down

0 comments on commit a9bee30

Please sign in to comment.