Skip to content

Commit 79debd9

Browse files
Kakueeendeepin-bot[bot]
authored andcommitted
fix: remove device pixel ratio scaling in drag pixmap
Removed device pixel ratio calculations from drag pixmap generation to fix incorrect scaling on high DPI displays. The code was incorrectly applying device pixel ratio multiple times which caused the drag preview image to be too small. Simplified the image scaling by using direct pixel dimensions without DPI scaling adjustments. Log: Fixed drag tab preview display on high DPI screens Influence: 1. Test dragging tabs on both standard and high DPI displays 2. Verify drag preview image size matches expected dimensions 3. Check that shadow effects render correctly around the preview 4. Test on different display scaling settings (100%, 150%, 200%) 5. Verify tab dragging functionality remains smooth fix: 修复拖拽标签页预览在高DPI显示下的缩放问题 移除拖拽图像生成中的设备像素比计算,修复在高DPI显示器上预览图像过小的问 题。代码之前多次应用设备像素比导致缩放不正确。简化图像缩放逻辑,直接使用 像素尺寸而不进行DPI缩放调整。 Log: 修复高DPI屏幕上拖拽标签页预览显示问题 Influence: 1. 在标准和高DPI显示器上测试拖拽标签页功能 2. 验证拖拽预览图像尺寸是否符合预期 3. 检查预览图像周围的阴影效果是否正确渲染 4. 在不同显示缩放设置下测试(100%、150%、200%) 5. 验证标签页拖拽功能保持流畅 BUG: https://pms.uniontech.com/bug-view-342405.html
1 parent 77f27ba commit 79debd9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/views/tabbar.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ QPixmap TabBar::createDragPixmapFromTab(int index, const QStyleOptionTab &option
546546
{
547547
Q_UNUSED(option)
548548

549-
const qreal ratio = qApp->devicePixelRatio();
550-
551549
QString termIdentifer = identifier(index);
552550
MainWindow *w = qobject_cast<MainWindow *>(this->window());
553551
if(!w)
@@ -557,12 +555,11 @@ QPixmap TabBar::createDragPixmapFromTab(int index, const QStyleOptionTab &option
557555
int width = termPage->width();
558556
int height = termPage->height();
559557
QImage screenshotImage(width, height, QImage::Format_ARGB32_Premultiplied);
560-
screenshotImage.setDevicePixelRatio(ratio);
561558
termPage->render(&screenshotImage, QPoint(), QRegion(0, 0, width, height));
562559

563-
// 根据对应的ration缩放图像
564-
int scaledWidth = static_cast<int>((width * ratio) / 5);
565-
int scaledHeight = static_cast<int>((height * ratio) / 5);
560+
// 缩放图像
561+
int scaledWidth = width / 5;
562+
int scaledHeight = height / 5;
566563
auto scaledImage = screenshotImage.scaled(scaledWidth, scaledHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
567564

568565
const int shadowRadius = 10;
@@ -591,8 +588,8 @@ QPixmap TabBar::createDragPixmapFromTab(int index, const QStyleOptionTab &option
591588
rectPath.addRect(0, 0, scaledWidth + shadowRadius, scaledHeight + shadowRadius);
592589
roundedRectPath.addRoundedRect(QRectF(0,
593590
0,
594-
(scaledWidth / ratio) + shadowRadius,
595-
(scaledHeight) / ratio + shadowRadius),
591+
scaledWidth + shadowRadius,
592+
scaledHeight + shadowRadius),
596593
cornerRadius,
597594
cornerRadius);
598595

0 commit comments

Comments
 (0)