fix: 修改wayland处理任务栏拖拽的逻辑

之前处理wayland逻辑存在不同, 修改部分逻辑保持显示一致

Log: 鼠标把应用图标拖拽出任务栏的效果显示有误
Bug: https://pms.uniontech.com/zentao/bug-view-100046.html
Influence: 任务栏-拖拽逻辑
Change-Id: I73c06291d69bf1c1e9c9ab7a4924d5fcfffd33ea
This commit is contained in:
duanhongyu 2021-12-16 20:01:31 +08:00
parent 0f538d708a
commit 72b1b37c35
2 changed files with 9 additions and 12 deletions

View File

@ -71,8 +71,7 @@ AppDragWidget::AppDragWidget(QWidget *parent)
initAnimations();
m_followMouseTimer->setSingleShot(Utils::IS_WAYLAND_DISPLAY);
m_followMouseTimer->setInterval(16);
m_followMouseTimer->setInterval(16);
connect(m_followMouseTimer, &QTimer::timeout, this, &AppDragWidget::onFollowMouse);
m_followMouseTimer->start();
}

View File

@ -552,15 +552,13 @@ void MainPanelControl::handleDragMove(QDragMoveEvent *e, bool isFilter)
DockItem *targetItem = nullptr;
if (isFilter) {
if (!Utils::IS_WAYLAND_DISPLAY) {
// appItem调整顺序或者移除驻留
targetItem = dropTargetItem(sourceItem, mapFromGlobal(m_appDragWidget->mapToGlobal(e->pos())));
// appItem调整顺序或者移除驻留
targetItem = dropTargetItem(sourceItem, mapFromGlobal(m_appDragWidget->mapToGlobal(e->pos())));
if (targetItem) {
m_appDragWidget->setOriginPos((m_appAreaSonWidget->mapToGlobal(targetItem->pos())));
} else {
targetItem = sourceItem;
}
if (targetItem) {
m_appDragWidget->setOriginPos((m_appAreaSonWidget->mapToGlobal(targetItem->pos())));
} else {
targetItem = sourceItem;
}
} else {
// other dockItem调整顺序
@ -666,7 +664,7 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
moveAppSonWidget();
}
if (!Utils::IS_WAYLAND_DISPLAY && m_appDragWidget && watched == static_cast<QGraphicsView *>(m_appDragWidget)->viewport()) {
if (m_appDragWidget && watched == static_cast<QGraphicsView *>(m_appDragWidget)->viewport()) {
bool isContains = rect().contains(mapFromGlobal(QCursor::pos()));
if (isContains) {
if (event->type() == QEvent::DragMove) {
@ -706,7 +704,7 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
static const QGSettings *g_settings = Utils::ModuleSettingsPtr("app");
if (!g_settings || !g_settings->keys().contains("removeable") || g_settings->get("removeable").toBool())
Utils::IS_WAYLAND_DISPLAY ? startDragWayland(item) : startDrag(item);
startDrag(item);
return QWidget::eventFilter(watched, event);
}