mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00

任务栏无法唤醒基本都是因为监听的屏幕区域没有在屏幕大小和坐标发生变化的时候及时更新信息, 显示错位是因为动画完成后内部有些变量未更新导致的, Log: 修复任务栏隐藏后切换位置或者调整屏幕无法唤起和显示到屏幕外部的问题 Bug: https://pms.uniontech.com/zentao/bug-view-34468.html Bug: https://pms.uniontech.com/zentao/bug-view-34467.html Bug: https://pms.uniontech.com/zentao/bug-view-34458.html Bug: https://pms.uniontech.com/zentao/bug-view-34454.html Bug: https://pms.uniontech.com/zentao/bug-view-34444.html Bug: https://pms.uniontech.com/zentao/bug-view-34437.html Bug: https://pms.uniontech.com/zentao/bug-view-34340.html Bug: https://pms.uniontech.com/zentao/bug-view-33718.html Bug: https://pms.uniontech.com/zentao/bug-view-33693.html Bug: https://pms.uniontech.com/zentao/bug-view-32854.html Bug: https://pms.uniontech.com/zentao/bug-view-32849.html Bug: https://pms.uniontech.com/zentao/bug-view-32830.html
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
#include <QPixmap>
|
|
#include <QImageReader>
|
|
#include <QApplication>
|
|
#include <QScreen>
|
|
|
|
namespace Utils {
|
|
inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) {
|
|
QImageReader reader;
|
|
QPixmap pixmap;
|
|
reader.setFileName(path);
|
|
if (reader.canRead()) {
|
|
reader.setScaledSize(size * devicePixelRatio);
|
|
pixmap = QPixmap::fromImage(reader.read());
|
|
pixmap.setDevicePixelRatio(devicePixelRatio);
|
|
}
|
|
else {
|
|
pixmap.load(path);
|
|
}
|
|
|
|
return pixmap;
|
|
}
|
|
|
|
inline QScreen * screenAt(const QPoint &point) {
|
|
for (QScreen *screen : qApp->screens()) {
|
|
const QRect r { screen->geometry() };
|
|
const QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
|
if (rect.contains(point)) {
|
|
return screen;
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
// 判断坐标是否位于屏幕边缘
|
|
inline bool onScreenEdge(const QPoint &point) {
|
|
for (QScreen *screen : qApp->screens()) {
|
|
const QRect r { screen->geometry() };
|
|
QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
|
if ( point.y() == screen->geometry().y()+screen->geometry().height()
|
|
|| point.x() == screen->geometry().x()+screen->geometry().width()) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
inline QScreen * screenAtByScaled(const QPoint &point) {
|
|
for (QScreen *screen : qApp->screens()) {
|
|
if (screen->geometry().contains(point)) {
|
|
return screen;
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
}
|