压力调节第一版

This commit is contained in:
2026-07-30 11:24:14 +08:00
parent dea3229996
commit f9a4b25d7d
4 changed files with 260 additions and 152 deletions
+12 -14
View File
@@ -427,22 +427,20 @@ void TestPrintWidget::openWorkFile(QString filePath){
// 将场景中所有项移动,使 pPicScene->itemsBoundingRect() 的左上角对齐到 scene 的 (0,0)
// 计算当前边界并做平移(仅在有偏移时执行)
{
QRectF bounds = pPicScene->itemsBoundingRect();
if (!bounds.isNull()) {
qreal dx = -bounds.x();
qreal dy = -bounds.y();
if (!qFuzzyIsNull(dx) || !qFuzzyIsNull(dy)) {
const auto items = pPicScene->items();
for (QGraphicsItem* it : items) {
// 仅移动属于场景根的项,避免重复移动子项
if (!it) continue;
QPointF oldPos = it->pos();
it->setPos(oldPos + QPointF(dx, dy));
}
QRectF bounds = pPicScene->itemsBoundingRect();
if (!bounds.isNull()) {
qreal dx = -bounds.x();
qreal dy = -bounds.y();
if (!qFuzzyIsNull(dx) || !qFuzzyIsNull(dy)) {
const auto items = pPicScene->items();
for (QGraphicsItem* it : items) {
// 仅移动属于场景根的项,避免重复移动子项
if (!it) continue;
QPointF oldPos = it->pos();
it->setPos(oldPos + QPointF(dx, dy));
}
}
}
}
pViewer->centerOn(0, 0);