From 5c3098aab287abecf3ec2bdf72e2560e16a1ab6a Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周五, 30 5月 2025 16:08:41 +0800 Subject: [PATCH] update qmsetup --- src/quick/quickwindowagent_win.cpp | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/quick/quickwindowagent_win.cpp b/src/quick/quickwindowagent_win.cpp index acfdd42..712e742 100644 --- a/src/quick/quickwindowagent_win.cpp +++ b/src/quick/quickwindowagent_win.cpp @@ -47,7 +47,11 @@ bool BorderItem::shouldEnableEmulatedPainter() const { # if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - auto api = window()->rendererInterface()->graphicsApi(); + const QQuickWindow* win = window(); + if (!win) { + return true; + } + auto api = win->rendererInterface()->graphicsApi(); switch (api) { case QSGRendererInterface::OpenGL: // FIXME: experimental, try to find the exact fixed version. @@ -97,21 +101,18 @@ BorderItem::~BorderItem() = default; void BorderItem::updateGeometry() { - setHeight(borderThickness()); + const QQuickWindow* win = window(); + if (!win) { + return; + } + setHeight(borderThickness() / win->effectiveDevicePixelRatio()); setVisible(isNormalWindow()); } void BorderItem::paint(QPainter *painter) { Q_UNUSED(painter) if (shouldEnableEmulatedPainter()) { - QRect rect(QPoint(0, 0), size().toSize()); - QRegion region(rect); - void *args[] = { - painter, - &rect, - ®ion, - }; - ctx->virtual_hook(AbstractWindowContext::DrawWindows10BorderHook_Emulated, args); + drawBorderEmulated(painter, QRect({0, 0}, size().toSize())); } else { needPaint = true; } @@ -170,7 +171,7 @@ void BorderItem::_q_afterSynchronizing() { if (needPaint) { needPaint = false; - drawBorder(); + drawBorderNative(); } } -- Gitblit v1.9.1