Skip to content

Commit e24358f

Browse files
dengzhongyuan365-devlzwind
authored andcommitted
fix(shot): align size tips with actual saved image dimensions
The selection size tooltip displayed recordWidth×DPR × recordHeight×DPR, but the actual crop applies -2 width and -1 height adjustments to avoid capturing the dashed selection border, causing a few pixels discrepancy between the displayed size and the saved image file info. bug: https://pms.uniontech.com/bug-view-353039.html
1 parent dc76388 commit e24358f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/widgets/toptips.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ void TopTips::updateTips(QPoint pos, const QSize &size)
7070

7171
QPoint startPoint = pos;
7272
qreal pixelRatio = qApp->primaryScreen()->devicePixelRatio();
73-
QSize s = QSize(static_cast<int>(size.width()*pixelRatio),static_cast<int>(size.height()*pixelRatio));
73+
// 与实际截图裁剪逻辑保持一致:宽度-2、高度-1(避开选区虚线边框)
74+
int tipWidth = qMax(static_cast<int>((size.width() - 2) * pixelRatio), 0);
75+
int tipHeight = qMax(static_cast<int>((size.height() - 1) * pixelRatio), 0);
76+
QSize s = QSize(tipWidth, tipHeight);
7477
setContent(s);
7578
startPoint.setX(pos.x());
7679

0 commit comments

Comments
 (0)