diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2022-08-10 09:30:49 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2022-08-10 07:56:26 +0000 |
commit | 52b8b51b32a63844004a9073a2d5161dd0e96dac (patch) | |
tree | 3cba19577433f2bdef6fc04ff52fd1a779cc8be2 | |
parent | c86d61846dd5f4725bc8cadf8698d463809710c9 (diff) |
ScxmlEditor: Prevent crash
Create the connection after populating the combobox prevents an
assertion.
Change-Id: I35be1cf724ed7084123e7070b377b50274132e55
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/plugins/scxmleditor/common/colorsettings.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/scxmleditor/common/colorsettings.cpp b/src/plugins/scxmleditor/common/colorsettings.cpp index 49bbb395efc..b375bbfe5e5 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<int>::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<int>::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() |