fix: 修复插件显示尺寸问题

在插件中绘制图像的时候,判断尺寸如果为自定义尺寸,则使用自定义尺寸来计算位置信息

Log: 修复插件的显示问题
Influence: 截图-查看截图计时插件是否正常显示
Bug: https://pms.uniontech.com/bug-view-179083.html
Change-Id: I76953a099d67f1a0abfee9afc63f4c1fae59696e
This commit is contained in:
donghualin 2023-01-03 13:23:56 +08:00
parent fe40557d5c
commit 9612bf2e11

View File

@ -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);