Fix list parameters lost on reload

parent 0fa9d4ff
Pipeline #1576 passed with stage
in 16 minutes and 56 seconds
......@@ -45,8 +45,10 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
// emit the signal of the base class when appropriate
// The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox
connect(this->m_list, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
[this](int) { emit valueChanged(m_index, m_list->itemData(m_list->currentIndex()).toString(), true); });
connect(this->m_list, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int) {
emit valueChanged(m_index, m_list->itemData(m_list->currentIndex()).toString(), true);
});
}
void ListParamWidget::setCurrentIndex(int index)
......@@ -88,6 +90,7 @@ QString ListParamWidget::getValue()
void ListParamWidget::slotRefresh()
{
const QSignalBlocker bk(m_list);
m_list->clear();
QStringList names = m_model->data(m_index, AssetParameterModel::ListNamesRole).toStringList();
QStringList values = m_model->data(m_index, AssetParameterModel::ListValuesRole).toStringList();
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>199</width>
<width>157</width>
<height>60</height>
</rect>
</property>
......@@ -26,16 +26,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_labelName">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="m_list"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="m_widgetComment" native="true">
<layout class="QGridLayout" name="_2">
......@@ -76,15 +66,18 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="m_labelName">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_list"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment