[vlc-commits] qt: fix data modifications not notified in VLCVarChoiceModel
Pierre Lamot
git at videolan.org
Fri Jul 5 17:44:55 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Jul 3 15:38:51 2019 +0200| [9804db53591388d5da3a581632fcbf6db9f8639b] | committer: Jean-Baptiste Kempf
qt: fix data modifications not notified in VLCVarChoiceModel
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9804db53591388d5da3a581632fcbf6db9f8639b
---
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
More information about the vlc-commits
mailing list