[vlc-commits] Qt: emit dataChanged on TrackListModel updates

Adrien Maglo git at videolan.org
Tue Jul 16 16:01:19 CEST 2019


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Jun 17 18:56:28 2019 +0200| [f89c91826caaa467cb0e22c27fec96c1672f642d] | committer: Jean-Baptiste Kempf

Qt: emit dataChanged on TrackListModel updates

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f89c91826caaa467cb0e22c27fec96c1672f642d
---

 modules/gui/qt/util/input_models.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/util/input_models.cpp b/modules/gui/qt/util/input_models.cpp
index 02b4b66455..8c795df1ef 100644
--- a/modules/gui/qt/util/input_models.cpp
+++ b/modules/gui/qt/util/input_models.cpp
@@ -79,11 +79,14 @@ void TrackListModel::updateTracks(vlc_player_list_action action, const vlc_playe
 {
     switch (action) {
     case VLC_PLAYER_LIST_ADDED:
+    {
         beginInsertRows({}, m_data.size(), m_data.size());
         m_data.append(Data{ track_info });
         endInsertRows();
+        QModelIndex dataIndex = index(m_data.size() - 1);
+        emit dataChanged(dataIndex, dataIndex);
         break;
-
+    }
     case VLC_PLAYER_LIST_REMOVED:
     {
         auto it = std::find_if(m_data.begin(), m_data.end(), [&](const Data& t) {
@@ -96,6 +99,8 @@ void TrackListModel::updateTracks(vlc_player_list_action action, const vlc_playe
         beginRemoveRows({}, pos, pos);
         m_data.erase(it);
         endRemoveRows();
+        QModelIndex dataIndex = index(pos);
+        emit dataChanged(dataIndex, dataIndex);
         break;
     }
     case VLC_PLAYER_LIST_UPDATED:



More information about the vlc-commits mailing list