From cc999cd5604184ace35e1464493d79836415ec56 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Thu, 6 Apr 2023 09:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E9=98=B4=E5=BD=B1=E4=B8=8E?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 8 ++++++++ src/windows/menu-main-window.cpp | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 446d649..fd8ecb2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,15 @@ int main(int argc, char *argv[]) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) +// SideBarApplication::setAttribute(Qt::AA_DisableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif + QCoreApplication::setApplicationName("ukui-menu"); QCoreApplication::setOrganizationName("ukui"); QCoreApplication::setOrganizationDomain("ukui.org"); diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index ce362ef..28a4a5d 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -99,7 +99,7 @@ void WindowHelper::setWindowAttribute(QWindow *window) } // kwin - KWindowSystem::setType(window->winId(), NET::Notification); + KWindowSystem::setType(window->winId(), NET::Normal); KWindowSystem::setState(window->winId(), NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher); if (!QX11Info::isPlatformX11()) { // wayland环境 设置跳过多任务视图,设置跳过任务栏s @@ -240,8 +240,13 @@ void WindowGeometryHelper::updateGeometry() int height = MenuSetting::instance()->get(MENU_HEIGHT).toInt(); int margin = MenuSetting::instance()->get(MENU_MARGIN).toInt(); - width = width > screenRect.width() ? screenRect.width() : width; - height = height > screenRect.height() ? screenRect.height() : height; + if (width > screenRect.width()) { + width = screenRect.width(); + } + if (height > screenRect.height()) { + height = screenRect.height(); + } + //上: 1, 下: 0, 左: 2, 右: 3 switch (m_panelPos) { @@ -388,6 +393,7 @@ void MenuWindow::init() setColor("transparent"); // setFlags(Qt::FramelessWindowHint); + setFlag(Qt::WindowStaysOnTopHint); WindowHelper::setWindowAttribute(this); WindowHelper::removeHeaderBar(this); WindowHelper::windowBlur(this, true);