Qt: Fix log window disabling itself on close

This commit is contained in:
Stenzek 2024-03-08 16:21:46 +10:00 committed by Connor McLaughlin
parent 7ed6801101
commit 5337e46f43
2 changed files with 2 additions and 15 deletions

View File

@ -76,7 +76,6 @@ void LogWindow::updateSettings()
}
else if (g_log_window)
{
g_log_window->m_destroying = true;
g_log_window->close();
g_log_window->deleteLater();
g_log_window = nullptr;
@ -89,7 +88,6 @@ void LogWindow::destroy()
if (!g_log_window)
return;
g_log_window->m_destroying = true;
g_log_window->close();
g_log_window->deleteLater();
g_log_window = nullptr;
@ -101,8 +99,6 @@ void LogWindow::reattachToMainWindow()
if (g_main_window->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen))
return;
resize(width(), g_main_window->height());
const QPoint new_pos = g_main_window->pos() + QPoint(g_main_window->width() + 10, 0);
if (pos() != new_pos)
move(new_pos);
@ -130,6 +126,7 @@ void LogWindow::updateWindowTitle()
void LogWindow::createUi()
{
setWindowIcon(QtHost::GetAppIcon());
setWindowFlag(Qt::WindowCloseButtonHint, false);
updateWindowTitle();
QAction* action;
@ -253,16 +250,7 @@ void LogWindow::closeEvent(QCloseEvent* event)
{
Log::SetHostOutputLevel(LOGLEVEL_NONE, nullptr);
// Save size when actually closing, disable ourselves if the user closed us.
if (m_destroying)
{
saveSize();
}
else
{
Host::SetBaseBoolSettingValue("Logging", "EnableLogWindow", false);
Host::CommitBaseSettingChanges();
}
saveSize();
QMainWindow::closeEvent(event);
}

View File

@ -48,7 +48,6 @@ private:
QMenu* m_level_menu;
bool m_attached_to_main_window = true;
bool m_destroying = false;
};
extern LogWindow* g_log_window;