[vlc-devel] [PATCH] qt: fix data modifications not notified in VLCVarChoiceModel
Pierre Lamot
pierre at videolabs.io
Wed Jul 3 15:38:51 CEST 2019
---
modules/gui/qt/adapters/var_choice_model.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/adapters/var_choice_model.cpp b/modules/gui/qt/adapters/var_choice_model.cpp
index ed3e9bf2b6..e283424b68 100644
--- a/modules/gui/qt/adapters/var_choice_model.cpp
+++ b/modules/gui/qt/adapters/var_choice_model.cpp
@@ -137,17 +137,20 @@ void VLCVarChoiceModel::onDataUpdated(const vlc_object_t* object, QVariant , QVa
return;
int oldCurrent = m_current;
+ m_current = -1;
for (int i = 0; i < m_values.count(); i++)
if( newvalue == m_values[i] )
{
m_current = i;
- if (oldCurrent == -1)
- emit hasCurrentChanged(true);
- return;
+ break;
}
- m_current = -1;
+
+ if (m_current != oldCurrent)
+ emit hasCurrentChanged(m_current != -1);
+ if (m_current != -1)
+ emit dataChanged(index(m_current), index(m_current), { Qt::CheckStateRole } );
if (oldCurrent != -1)
- emit hasCurrentChanged(false);
+ emit dataChanged(index(oldCurrent), index(oldCurrent), { Qt::CheckStateRole } );
}
//update the choices of the variable, called on UI thread
--
2.17.1
More information about the vlc-devel
mailing list