Skip to content

Commit

Permalink
feat: Change default shortcuts popup position
Browse files Browse the repository at this point in the history
调整默认快捷键浮窗弹出位置.
现在将显示在焦点屏幕(光标所在屏幕)中央.

Log: 调整默认快捷键浮窗弹出位置
Task: https://pms.uniontech.com/task-view-332267.html
Influence: Shortcuts
  • Loading branch information
rb-union committed Mar 26, 2024
1 parent 6c7ece5 commit ecca163
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/widgets/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,18 @@ void Window::displayShortcuts()
QRect rect = window()->geometry();
QPoint pos(rect.x() + rect.width() / 2,
rect.y() + rect.height() / 2);
// 获取当前焦点位置(光标所在屏幕中心)
QScreen *screen = nullptr;
if (DGuiApplicationHelper::isTabletEnvironment()) {
// bug 88079 避免屏幕旋转弹出位置错误
screen = qApp->primaryScreen();
} else {
screen = QGuiApplication::screenAt(QCursor::pos());
}

if (screen) {
pos = screen->geometry().center();
}

//窗体快捷键
QStringList windowKeymaps;
Expand Down

0 comments on commit ecca163

Please sign in to comment.