From c0c407f8a8a4a343374b6d803c343e67e48a0fc9 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 26 Jul 2014 11:56:34 +0300 Subject: [PATCH] Call ZoomFitBest() twice before show pattern. --HG-- branch : develop --- src/app/mainwindow.cpp | 34 +++++++++++++++++++++------- src/app/mainwindow.h | 1 + src/app/tools/drawTools/vtoolarc.cpp | 1 + 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 0c50e3dd3..0438a7d4c 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -2022,15 +2022,8 @@ void MainWindow::LoadPattern(const QString &fileName) qApp->setOpeningPattern();// End opening file - VAbstractTool::NewSceneRect(sceneDraw, view); - VAbstractTool::NewSceneRect(sceneDetails, view); - //Fit scene size to best size for first show - ActionDetails(true); - view->ZoomFitBest(); - - ActionDraw(true); - view->ZoomFitBest(); + ZoomFirstShow(); } //--------------------------------------------------------------------------------------------------------------------- @@ -2127,3 +2120,28 @@ void MainWindow::EndVisualization(bool click) dialogTool->ShowDialog(click); } } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief ZoomFirstShow Fit scene size to best size for first show + */ +void MainWindow::ZoomFirstShow() +{ + /* If don't call ZoomFitBest() twice, after first scaling or moving pattern piece, scene change coordinate and whole + * pattern will be moved. Looks very ugly. It is best solution that i have now. + */ + ActionDetails(true); + view->ZoomFitBest(); + + ActionDraw(true); + view->ZoomFitBest(); + + VAbstractTool::NewSceneRect(sceneDraw, view); + VAbstractTool::NewSceneRect(sceneDetails, view); + + ActionDetails(true); + view->ZoomFitBest(); + + ActionDraw(true); + view->ZoomFitBest(); +} diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 797be40a1..4e72d9149 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -239,6 +239,7 @@ private: * @brief EndVisualization try show dialog after and working with tool visualization. */ void EndVisualization(bool click = false); + void ZoomFirstShow(); }; #endif // MAINWINDOW_H diff --git a/src/app/tools/drawTools/vtoolarc.cpp b/src/app/tools/drawTools/vtoolarc.cpp index 2b596bb25..53d430e6c 100644 --- a/src/app/tools/drawTools/vtoolarc.cpp +++ b/src/app/tools/drawTools/vtoolarc.cpp @@ -157,6 +157,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 ¢er, QString &ra VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); scene->addItem(toolArc); connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArc::SetFactor); connect(scene, &VMainGraphicsScene::DisableItem, toolArc, &VToolArc::Disable); doc->AddTool(id, toolArc); doc->IncrementReferens(center);