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 ...@@ -45,8 +45,10 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
// emit the signal of the base class when appropriate // emit the signal of the base class when appropriate
// The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox // The connection is ugly because the signal "currentIndexChanged" is overloaded in QComboBox
connect(this->m_list, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), 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); }); [this](int) {
emit valueChanged(m_index, m_list->itemData(m_list->currentIndex()).toString(), true);
});
} }
void ListParamWidget::setCurrentIndex(int index) void ListParamWidget::setCurrentIndex(int index)
...@@ -88,6 +90,7 @@ QString ListParamWidget::getValue() ...@@ -88,6 +90,7 @@ QString ListParamWidget::getValue()
void ListParamWidget::slotRefresh() void ListParamWidget::slotRefresh()
{ {
const QSignalBlocker bk(m_list);
m_list->clear(); m_list->clear();
QStringList names = m_model->data(m_index, AssetParameterModel::ListNamesRole).toStringList(); QStringList names = m_model->data(m_index, AssetParameterModel::ListNamesRole).toStringList();
QStringList values = m_model->data(m_index, AssetParameterModel::ListValuesRole).toStringList(); QStringList values = m_model->data(m_index, AssetParameterModel::ListValuesRole).toStringList();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>199</width> <width>157</width>
<height>60</height> <height>60</height>
</rect> </rect>
</property> </property>
...@@ -26,16 +26,6 @@ ...@@ -26,16 +26,6 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </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"> <item row="1" column="0" colspan="2">
<widget class="QWidget" name="m_widgetComment" native="true"> <widget class="QWidget" name="m_widgetComment" native="true">
<layout class="QGridLayout" name="_2"> <layout class="QGridLayout" name="_2">
...@@ -76,15 +66,18 @@ ...@@ -76,15 +66,18 @@
</layout> </layout>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </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