From 52b8b51b32a63844004a9073a2d5161dd0e96dac Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 10 Aug 2022 09:30:49 +0200 Subject: ScxmlEditor: Prevent crash Create the connection after populating the combobox prevents an assertion. Change-Id: I35be1cf724ed7084123e7070b377b50274132e55 Reviewed-by: hjk --- src/plugins/scxmleditor/common/colorsettings.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/scxmleditor/common/colorsettings.cpp b/src/plugins/scxmleditor/common/colorsettings.cpp index 49bbb395ef..b375bbfe5e 100644 --- a/src/plugins/scxmleditor/common/colorsettings.cpp +++ b/src/plugins/scxmleditor/common/colorsettings.cpp @@ -39,11 +39,6 @@ ColorSettings::ColorSettings(QWidget *parent) m_ui.setupUi(this); m_ui.m_colorThemeView->setEnabled(false); - connect(m_ui.m_comboColorThemes, QOverload::of(&QComboBox::currentIndexChanged), - this, &ColorSettings::selectTheme); - connect(m_ui.m_colorThemeView, &ColorThemeView::colorChanged, this, &ColorSettings::updateCurrentColors); - connect(m_ui.m_addColorTheme, &QToolButton::clicked, this, &ColorSettings::createTheme); - connect(m_ui.m_removeColorTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme); const QSettings *s = Core::ICore::settings(); @@ -53,6 +48,12 @@ ColorSettings::ColorSettings(QWidget *parent) for (auto it = m_colorThemes.cbegin(); it != m_colorThemes.cend(); ++it) m_ui.m_comboColorThemes->addItem(it.key()); m_ui.m_comboColorThemes->setCurrentText(s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString()); + + connect(m_ui.m_comboColorThemes, QOverload::of(&QComboBox::currentIndexChanged), + this, &ColorSettings::selectTheme); + connect(m_ui.m_colorThemeView, &ColorThemeView::colorChanged, this, &ColorSettings::updateCurrentColors); + connect(m_ui.m_addColorTheme, &QToolButton::clicked, this, &ColorSettings::createTheme); + connect(m_ui.m_removeColorTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme); } void ColorSettings::save() -- cgit v1.2.1