From 0f538d708aab36ca37377db0ba81e07732ccfc02 Mon Sep 17 00:00:00 2001 From: songwentao Date: Thu, 16 Dec 2021 23:37:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D2d=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E4=BB=8E=E4=BB=BB=E5=8A=A1=E6=A0=8F=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E4=BA=A4=E6=8D=A2=E4=BD=8D=E7=BD=AE=E5=8D=A1?= =?UTF-8?q?=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onFollowMouse()每1毫秒执行一次影响了系统性能影响了DragMove事件传递 修改为16ms,更新频次接近60Hz. Log: Task: https://pms.uniontech.com/zentao/task-view-95274.html Influence: 任务栏-2d模式下拖动应用交换位置流畅,不再卡顿 Change-Id: I4cfb70098081af06290c54c93d065425c20dc482 --- frame/item/components/appdragwidget.cpp | 6 +++--- frame/window/mainpanelcontrol.cpp | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frame/item/components/appdragwidget.cpp b/frame/item/components/appdragwidget.cpp index a6957e4cf..30ce5890c 100644 --- a/frame/item/components/appdragwidget.cpp +++ b/frame/item/components/appdragwidget.cpp @@ -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绘制的图标 } } diff --git a/frame/window/mainpanelcontrol.cpp b/frame/window/mainpanelcontrol.cpp index c879f0f41..bda56be85 100755 --- a/frame/window/mainpanelcontrol.cpp +++ b/frame/window/mainpanelcontrol.cpp @@ -422,6 +422,8 @@ void MainPanelControl::removeItem(DockItem *item) break; } + item->removeEventFilter(this); + /** 此处重新计算大小的时候icon的个数在原有个数上减少了一个,导致每个icon的大小跟原来大小不一致,需要重新设置setFixedSize * 在龙芯处理器上当app数量过多时,会导致拖动app耗时严重,造成卡顿 * 注意:不能屏蔽此接口,否则会造成插件移除时无法更新icon大小