From 7903cd520a2f78116f1c5148fa354fb103bb96f5 Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Sat, 8 Jan 2022 22:03:53 +0100 Subject: [PATCH] perform restartLayout conditionally (#4513) * Revert "Fixed layout on Deck Editor not using last layout. It was reseting layout on ctor. (#4420)" This reverts commit 3bc90003b3579b76cc40bbd3cf9e62bf0ad4fca8. * restart layout on fresh installs --- cockatrice/src/tab_deck_editor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index c145bef2..eb403415 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -559,8 +559,13 @@ void TabDeckEditor::refreshShortcuts() void TabDeckEditor::loadLayout() { LayoutsSettings &layouts = SettingsCache::instance().layouts(); - restoreState(layouts.getDeckEditorLayoutState()); - restoreGeometry(layouts.getDeckEditorGeometry()); + auto &layoutState = layouts.getDeckEditorLayoutState(); + if (layoutState.isNull()) { + restartLayout(); + } else { + restoreState(layoutState); + restoreGeometry(layouts.getDeckEditorGeometry()); + } aCardInfoDockVisible->setChecked(cardInfoDock->isVisible()); aFilterDockVisible->setChecked(filterDock->isVisible()); @@ -605,7 +610,7 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts())); refreshShortcuts(); - QTimer::singleShot(0, this, SLOT(loadLayout())); + loadLayout(); } TabDeckEditor::~TabDeckEditor()