mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 修复从任务栏向上拖动插件引起任务栏崩溃的问题
遍历插件的时候,for循环中的容器错误 Log: Influence: 从任务栏向上拖动插件,观察任务栏是否正常 Bug: https://pms.uniontech.com/bug-view-181945.html Change-Id: Icf93d225680cd257e446855d03bb9434e07c27ea
This commit is contained in:
parent
1be68d06b2
commit
4800acce2c
@ -69,7 +69,7 @@ void QuickPluginModel::removePlugin(PluginsItemInterface *itemInter)
|
||||
}
|
||||
|
||||
if (m_dockedPluginsItems.contains(itemInter)) {
|
||||
m_dockedPluginsItems.removeOne(itemInter);
|
||||
m_dockedPluginsItems.removeAll(itemInter);
|
||||
Q_EMIT requestUpdate();
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ void QuickPluginModel::onPluginRemoved(PluginsItemInterface *itemInter)
|
||||
// 如果插件移除,无需移除下方的排序设置,因为下次插件插入的时候还会插入到下方任务栏
|
||||
// 因此,此处只需要从列表中移除当前插件
|
||||
if (m_dockedPluginsItems.contains(itemInter))
|
||||
m_dockedPluginsItems.removeOne(itemInter);
|
||||
m_dockedPluginsItems.removeAll(itemInter);
|
||||
// 向外发送更新列表的信号
|
||||
Q_EMIT requestUpdate();
|
||||
}
|
||||
@ -222,7 +222,6 @@ int QuickPluginModel::generaIndex(int insertIndex, int oldIndex)
|
||||
// 新的位置的索引值大于原来位置的索引值,则认为插入在原来的任务栏的后面,将前面的插件的索引值减去1
|
||||
for (PluginsItemInterface *itemInter : m_dockedPluginsItems) {
|
||||
int pluginDockIndex = getCurrentIndex(itemInter);
|
||||
qInfo() << itemInter->pluginDisplayName() << m_dockedPluginIndex[itemInter->pluginName()] << pluginDockIndex;
|
||||
if (pluginDockIndex > oldIndex) {
|
||||
if (pluginDockIndex <= insertIndex) {
|
||||
int tmpIndex = m_dockedPluginIndex[itemInter->pluginName()];
|
||||
|
@ -657,10 +657,9 @@ int QuickPluginWindow::getDropIndex(QPoint point)
|
||||
return -1;
|
||||
}
|
||||
|
||||
QList<PluginsItemInterface *> dockItemInter = QuickPluginModel::instance()->dockedPluginItems();
|
||||
if (m_position == Dock::Position::Top || m_position == Dock::Position::Bottom) {
|
||||
// 上下方向从右向左排列
|
||||
for (int i = 0; i < dockItemInter.count() - 1; i++) {
|
||||
for (int i = 0; i < dockedItems.count() - 1; i++) {
|
||||
QuickDockItem *dockBeforeItem = dockedItems[i];
|
||||
QuickDockItem *dockItem = dockedItems[i + 1];
|
||||
if (!dockItem->canInsert())
|
||||
@ -671,7 +670,7 @@ int QuickPluginWindow::getDropIndex(QPoint point)
|
||||
}
|
||||
} else {
|
||||
// 左右方向从下向上排列
|
||||
for (int i = 0; i < dockItemInter.count() - 1; i++) {
|
||||
for (int i = 0; i < dockedItems.count() - 1; i++) {
|
||||
QuickDockItem *dockBeforeItem = dockedItems[i];
|
||||
QuickDockItem *dockItem = dockedItems[i + 1];
|
||||
if (!dockItem->canInsert())
|
||||
|
Loading…
x
Reference in New Issue
Block a user