fix: 任务栏移除图标时提示信息异常

2D模式下,移除图标时,会使用一个新的图标,并缩小原来图标的大小,但设置鼠标拖动位置时判断图标错误,造成异常

Log: 修复2D模式下任务栏移除应用程序发现移除提示异常
Bug: https://pms.uniontech.com/zentao/bug-view-44994.html
Change-Id: I3a5e148582d5792555603825c8ca281c84bc4b33
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/3026
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com>
Reviewed-by: niecheng <niecheng@uniontech.com>
Tested-by: <mailman@uniontech.com>
This commit is contained in:
xiechuan 2020-08-28 18:47:34 +08:00
parent b8d7f24ebe
commit 648b990fc8
2 changed files with 8 additions and 3 deletions

View File

@ -107,7 +107,11 @@ AppDragWidget::AppDragWidget(QWidget *parent) :
m_followMouseTimer->setInterval(1);
connect(m_followMouseTimer, &QTimer::timeout, [this] {
QPoint destPos = QCursor::pos();
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
if (DWindowManagerHelper::instance()->hasComposite()) {
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
} else {
move(destPos.x(), destPos.y()); //窗口特效未开启时会隐藏m_object绘制的图标移动的图标为QDrag绘制的图标大小为(10,10)
}
});
m_followMouseTimer->start();
}
@ -297,7 +301,7 @@ void AppDragWidget::initConfigurations()
const QByteArray &schema_id {
cschema.toUtf8()
};
const QByteArray &path_id {
cpath.toUtf8()
};

View File

@ -695,11 +695,12 @@ void MainPanelControl::startDrag(DockItem *item)
}
drag = appDrag;
drag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF());
} else {
drag = new QDrag(item);
drag->setPixmap(pixmap);
drag->setHotSpot(pixmap.rect().center() / pixmap.devicePixelRatioF());
}
drag->setHotSpot(pixmap.rect().center() / pixmap.devicePixelRatioF());
drag->setMimeData(new QMimeData);
drag->exec(Qt::MoveAction);