2026年7月16日 缓存
This commit is contained in:
+40
-7
@@ -69,16 +69,16 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
pPicScene = new PicScene(this);
|
||||
|
||||
//edit@12-09
|
||||
pPicScene->setSceneRect(QRectF(0,0, 3999, 32));
|
||||
pPicScene->setSceneRect(QRectF(0,0, 3999, SCENE_MAX_HEIGHT));
|
||||
ui.graphicsView->setScene(pPicScene);
|
||||
ui.graphicsView->centerOn(0,0);
|
||||
// ui->senceEditOption->bindScene(pPicScene, ui->graphicsView, ui->textEdit);
|
||||
this->pPicScene->setIsdrawBackground(true);
|
||||
|
||||
// 哪个天才写的?拿view和scene计算一下会死吗?
|
||||
for(int i=0;i<3;i++){
|
||||
on_enlargeButton_pressed();
|
||||
}
|
||||
// for(int i=0;i<3;i++){
|
||||
// on_enlargeButton_pressed();
|
||||
// }
|
||||
|
||||
connect(pPicScene,&PicScene::selectionChanged,this,[=]() {
|
||||
getShowSelectItemText();
|
||||
@@ -178,7 +178,7 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
|
||||
if (ret == QMessageBox::Ok){
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->saveLastWork();
|
||||
emit sig_updatePrintContent();
|
||||
} else {
|
||||
@@ -400,7 +400,7 @@ void TestPrintWidget::on_saveButton_pressed()
|
||||
qDebug()<<"xml file null";
|
||||
#ifdef MYSAVEFILEDLG
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->refreshListView(editMode);
|
||||
dialogSaveFile->show();
|
||||
dialogSaveFile->setEnterFileName("");
|
||||
@@ -492,7 +492,7 @@ void TestPrintWidget::onSaveASFile(QString filename,bool Flag){// use for dialog
|
||||
|
||||
saveFile();
|
||||
if(sysPara){
|
||||
sysPara->sysFile =xmlfileName;
|
||||
sysPara->sysFile = xmlfileName;
|
||||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
}
|
||||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
@@ -609,6 +609,19 @@ void TestPrintWidget::onFileOpen(QString filePath,bool reviewFlag){
|
||||
}
|
||||
}
|
||||
}
|
||||
// 主动暂停打印
|
||||
if(reviewFlag) {
|
||||
emit sig_stopPrint();
|
||||
|
||||
// xmlfileName 会被 saveLastWork 更改,因此此处暂存变量, 在执行后恢复
|
||||
qDebug() << "xmlfileName:" << xmlfileName;
|
||||
auto filename = xmlfileName;
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->saveLastWork();
|
||||
xmlfileName = filename;
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
}
|
||||
|
||||
emit sendButtonClickedSignal(20); //打开文件完成跳转到主窗口
|
||||
}
|
||||
@@ -1062,6 +1075,26 @@ bool TestPrintWidget::eventFilter(QObject *watched, QEvent *event) {
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void TestPrintWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
|
||||
pPicScene->update();
|
||||
auto sceneRect = pPicScene->sceneRect();
|
||||
// qreal sceneHeight = boundingRect.height() > (qreal)(sysPara->para.canvasHeight) ? SCENE_MAX_HEIGHT : (qreal)(sysPara->para.canvasHeight);
|
||||
qreal sceneHeight = qMin(qreal(SCENE_MAX_HEIGHT), (qreal)(sysPara->para.canvasHeight));
|
||||
sceneRect.setHeight(sceneHeight);
|
||||
pPicScene->setSceneRect(sceneRect);
|
||||
|
||||
// 以高度为基准 最大化显示场景到 视口
|
||||
auto viewportHeight = pViewer->viewport()->height();
|
||||
QTransform transform = pViewer->transform();
|
||||
auto targetScale = viewportHeight / sceneRect.height();
|
||||
double currentScale = transform.m11();
|
||||
double relativeScale = targetScale / currentScale;
|
||||
pViewer->scale(relativeScale, relativeScale);
|
||||
}
|
||||
|
||||
void TestPrintWidget::onBtn3DClicked()
|
||||
{
|
||||
#if defined(ARCH_AARCH64)
|
||||
|
||||
Reference in New Issue
Block a user