From 820e455ee1340a76fd945d254ee091a37216b95a Mon Sep 17 00:00:00 2001 From: jzxc95 <907297917@qq.com> Date: Wed, 24 May 2023 15:35:06 +0800 Subject: [PATCH] =?UTF-8?q?5.15=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-vpn/main.cpp | 5 +++++ src/frontend/mainwindow.cpp | 1 + src/frontend/tab-pages/lanpage.cpp | 1 + src/main.cpp | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/src-vpn/main.cpp b/src-vpn/main.cpp index f7f309e7..99fb9b59 100644 --- a/src-vpn/main.cpp +++ b/src-vpn/main.cpp @@ -80,8 +80,13 @@ int main(int argc, char *argv[]) { initUkuiLog4qt("kylin-vpn"); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif QString id = QString("kylin-vpn"+ QLatin1String(getenv("DISPLAY"))); QtSingleApplication a(id, argc, argv); diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 8b79a573..8462b535 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -908,6 +908,7 @@ void MainWindow::showCreateWiredConnectWidget(const QString devName) }); m_createPagePtrMap.insert(devName, netDetail); netDetail->show(); + KWindowSystem::raiseWindow(netDetail->winId()); netDetail->centerToScreen(); } diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 04fe3e38..10e7b72a 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -1277,6 +1277,7 @@ void LanPage::showDetailPage(QString devName, QString uuid) NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false); m_lanPagePtrMap.insert(p_item->m_connectPath, netDetail); netDetail->show(); + KWindowSystem::raiseWindow(netDetail->winId()); netDetail->centerToScreen(); connect(netDetail, &NetDetail::detailPageClose, [&](QString deviceName, QString lanName, QString lanUuid){ diff --git a/src/main.cpp b/src/main.cpp index 1eff8ac7..765ddeb8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -82,8 +82,13 @@ int main(int argc, char *argv[]) { initUkuiLog4qt("kylin-nm"); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif // QApplication a(argc, argv); QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));