UI: HomeWindow: Don't activate menu on closing

This commit is contained in:
Nodir Temirkhodjaev 2023-05-08 16:13:15 +03:00
parent 2806813f48
commit 74e11cf323
3 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,7 @@ HomeWindow::HomeWindow(QWidget *parent) :
setupStateWatcher();
connect(this, &HomeWindow::activationChanged, this, [&] {
if (isActiveWindow()) {
if (isActiveWindow() && !isClosing()) {
m_btMenu->showMenu();
}
});

View File

@ -34,6 +34,8 @@ void WidgetWindow::hideEvent(QHideEvent *event)
void WidgetWindow::closeEvent(QCloseEvent *event)
{
m_isClosing = true;
emit aboutToClose();
QWidget::closeEvent(event);

View File

@ -10,6 +10,8 @@ class WidgetWindow : public QWidget
public:
explicit WidgetWindow(QWidget *parent = nullptr);
bool isClosing() const { return m_isClosing; }
signals:
void activationChanged();
@ -31,6 +33,9 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
void changeEvent(QEvent *event) override;
private:
bool m_isClosing = false;
};
#endif // WIDGETWINDOW_H