feat: 修复2d模式下从任务栏拖拽应用交换位置卡顿问题

onFollowMouse()每1毫秒执行一次影响了系统性能影响了DragMove事件传递
修改为16ms,更新频次接近60Hz.

Log:
Task: https://pms.uniontech.com/zentao/task-view-95274.html
Influence: 任务栏-2d模式下拖动应用交换位置流畅,不再卡顿
Change-Id: I4cfb70098081af06290c54c93d065425c20dc482
This commit is contained in:
songwentao 2021-12-16 23:37:40 +08:00
parent 3f073306d1
commit 0f538d708a
2 changed files with 5 additions and 3 deletions

View File

@ -70,9 +70,9 @@ AppDragWidget::AppDragWidget(QWidget *parent)
setAcceptDrops(true);
initAnimations();
m_followMouseTimer->setSingleShot(Utils::IS_WAYLAND_DISPLAY);
m_followMouseTimer->setInterval(1);
m_followMouseTimer->setInterval(16);
connect(m_followMouseTimer, &QTimer::timeout, this, &AppDragWidget::onFollowMouse);
m_followMouseTimer->start();
}
@ -376,7 +376,7 @@ void AppDragWidget::onFollowMouse()
if (DWindowManagerHelper::instance()->hasComposite()) {
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
} else {
move(destPos.x(), destPos.y()); //窗口特效未开启时会隐藏m_object绘制的图标移动的图标为QDrag绘制的图标,大小为(10,10)
move(destPos.x(), destPos.y()); // 窗口特效未开启时会隐藏m_object绘制的图标移动的图标为QDrag绘制的图标
}
}

View File

@ -422,6 +422,8 @@ void MainPanelControl::removeItem(DockItem *item)
break;
}
item->removeEventFilter(this);
/** 此处重新计算大小的时候icon的个数在原有个数上减少了一个导致每个icon的大小跟原来大小不一致需要重新设置setFixedSize
* app数量过多时app耗时严重
* :icon大小