添加内核logo程序更新;编辑界面打开时;所有item相对对齐到scene(0,0);
This commit is contained in:
+20
-6
@@ -67,11 +67,6 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
// ui->senceEditOption->bindScene(pPicScene, ui->graphicsView, ui->textEdit);
|
||||
this->pPicScene->setIsdrawBackground(true);
|
||||
|
||||
// 哪个天才写的?拿view和scene计算一下会死吗?
|
||||
// for(int i=0;i<3;i++){
|
||||
// on_enlargeButton_pressed();
|
||||
// }
|
||||
|
||||
connect(pPicScene,&PicScene::selectionChanged,this,[=]() {
|
||||
getShowSelectItemText();
|
||||
});
|
||||
@@ -191,7 +186,7 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
saveFile();
|
||||
}
|
||||
|
||||
emit sig_updatePrintContent(xmlfileName);
|
||||
emit sig_switchWorkFileRequested(xmlfileName);
|
||||
}
|
||||
|
||||
emit sendButtonClickedSignal(20);
|
||||
@@ -430,6 +425,25 @@ void TestPrintWidget::openWorkFile(QString filePath){
|
||||
|
||||
xmlfileName = 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(m_printSetting) {
|
||||
m_printSetting->setModel(m_printSettingModel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user