From kde-commits Tue Mar 01 16:23:33 2016 From: Weng Xuetian Date: Tue, 01 Mar 2016 16:23:33 +0000 To: kde-commits Subject: [plasma-workspace] applets/systemtray/plugin: Workaround by always reset model when insert and remov Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=145684943302181 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/6a26adb50c0bfce031df55bf200ebc7f444= 20301 diff --git a/applets/systemtray/plugin/tasklistmodel.cpp b/applets/systemtr= ay/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 =3D qLowerBound(m_tasks.begin(), m_tasks.end(), task, task= LessThan); - int index =3D 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 =3D m_tasks.indexOf(task); if (index >=3D 0 ) { - beginRemoveRows(QModelIndex(), index, index); + // use ResetModel as a workaround for bug 352055 + beginResetModel(); m_tasks.removeAt(index); - endRemoveRows(); + endResetModel(); } } =20