Skip to content

Commit

Permalink
UI: Hide on close
Browse files Browse the repository at this point in the history
fixes crash when reshowing the window
  • Loading branch information
univrsal committed Mar 20, 2022
1 parent f020edf commit 4357559
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/durchblick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ void Durchblick::contextMenuEvent(QContextMenuEvent* e)
{
}

void Durchblick::closeEvent(QCloseEvent* e)
{
e->ignore();
hide();
}

Durchblick::Durchblick(QWidget* widget)
: OBSQTDisplay(widget, Qt::Window)
, m_layout(this)
Expand All @@ -81,7 +87,7 @@ Durchblick::Durchblick(QWidget* widget)
#else
setWindowIcon(QIcon::fromTheme("obs", QIcon(":/res/images/obs.png")));
#endif
setAttribute(Qt::WA_DeleteOnClose, true);
setAttribute(Qt::WA_DeleteOnClose, false);
// disable application quit when last window closed
setAttribute(Qt::WA_QuitOnClose, false);
setMouseTracking(true);
Expand Down
2 changes: 2 additions & 0 deletions src/durchblick.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private slots:
virtual void mouseDoubleClickEvent(QMouseEvent*) override;
virtual void contextMenuEvent(QContextMenuEvent*) override;

virtual void closeEvent(QCloseEvent*) override;

protected:
// void dragEnterEvent(QDragEnterEvent *event) override;
// void dragMoveEvent(QDragMoveEvent *event) override;
Expand Down

0 comments on commit 4357559

Please sign in to comment.