[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace] applets/systemtray/plugin: Workaround by always reset model when insert and remov
From:       Weng Xuetian <wengxt () gmail ! com>
Date:       2016-03-01 16:23:33
Message-ID: E1aan5B-0003km-21 () scm ! kde ! org
[Download RAW message or body]

Git commit 6a26adb50c0bfce031df55bf200ebc7f44420301 by Weng Xuetian.
Committed on 01/03/2016 at 16:05.
Pushed by xuetianweng into branch 'master'.

Workaround by always reset model when insert and remove from model.

CCBUG: 352055

M  +6    -5    applets/systemtray/plugin/tasklistmodel.cpp

http://commits.kde.org/plasma-workspace/6a26adb50c0bfce031df55bf200ebc7f44420301

diff --git a/applets/systemtray/plugin/tasklistmodel.cpp b/applets/systemtray/plugin/tasklistmodel.cpp
index 1fa306c..473d61c 100644
--- a/applets/systemtray/plugin/tasklistmodel.cpp
+++ b/applets/systemtray/plugin/tasklistmodel.cpp
@@ -102,10 +102,10 @@ void SystemTray::TaskListModel::addTask(Task *task)
 {
     if (!m_tasks.contains(task)) {
         auto it = qLowerBound(m_tasks.begin(), m_tasks.end(), task, taskLessThan);
-        int index = it - m_tasks.begin();
-        beginInsertRows(QModelIndex(), index, index);
+        // use ResetModel as a workaround for bug 352055
+        beginResetModel();
         m_tasks.insert(it, task);
-        endInsertRows();
+        endResetModel();
     }
 }
 
@@ -113,9 +113,10 @@ void SystemTray::TaskListModel::removeTask(Task *task)
 {
     int index = m_tasks.indexOf(task);
     if (index >= 0 ) {
-        beginRemoveRows(QModelIndex(), index, index);
+        // use ResetModel as a workaround for bug 352055
+        beginResetModel();
         m_tasks.removeAt(index);
-        endRemoveRows();
+        endResetModel();
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic