From 9612bf2e114255f1d95a7027869db0a74d5fb86b Mon Sep 17 00:00:00 2001 From: donghualin Date: Tue, 3 Jan 2023 13:23:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B0=BA=E5=AF=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在插件中绘制图像的时候,判断尺寸如果为自定义尺寸,则使用自定义尺寸来计算位置信息 Log: 修复插件的显示问题 Influence: 截图-查看截图计时插件是否正常显示 Bug: https://pms.uniontech.com/bug-view-179083.html Change-Id: I76953a099d67f1a0abfee9afc63f4c1fae59696e --- frame/window/quickpluginwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frame/window/quickpluginwindow.cpp b/frame/window/quickpluginwindow.cpp index d019b4e77..d6d42ed98 100644 --- a/frame/window/quickpluginwindow.cpp +++ b/frame/window/quickpluginwindow.cpp @@ -681,8 +681,13 @@ void QuickDockItem::paintEvent(QPaintEvent *event) return QWidget::paintEvent(event); QPixmap pixmap = iconPixmap(); - QRect pixmapRect = QRect((rect().width() - ICONHEIGHT) / 2, (rect().height() - ICONHEIGHT) / 2, - ICONHEIGHT, ICONHEIGHT); + int width = ICONWIDTH; + int height = ICONHEIGHT; + if (m_pluginItem->pluginSizePolicy() == PluginsItemInterface::PluginSizePolicy::Custom) { + width = pixmap.width(); + height = pixmap.height(); + } + QRect pixmapRect = QRect(QPoint((rect().width() - width) / 2, (rect().height() - height) / 2), pixmap.size()); QPainter painter(this); painter.drawPixmap(pixmapRect, pixmap);