Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Change default shortcuts popup position #164

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/src/mainwindow/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2020-2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2020-2024 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -17,9 +17,11 @@
#include <QStandardPaths>
#include <QDebug>
#include <QApplication>
#include <QScreen>

#include <DTableView>
#include <DFileDialog>
#include <DGuiApplicationHelper>

#include "module/view/homepagewidget.h"
#include <libimageviewer/imageviewer.h>
Expand Down Expand Up @@ -400,6 +402,20 @@ void MainWindow::showShortCut()
qDebug() << "receive Ctrl+Shift+/";
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 shortcutString;
QJsonObject json = createShorcutJson();
Expand Down
Loading