diff --git a/src/app/container/vcontainer.cpp b/src/app/container/vcontainer.cpp index fbc2d10f7..c2242a3cc 100644 --- a/src/app/container/vcontainer.cpp +++ b/src/app/container/vcontainer.cpp @@ -536,6 +536,7 @@ QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &s */ void VContainer::UpdateGObject(quint32 id, VGObject* obj) { + SCASSERT(obj != nullptr); UpdateObject(gObjects, id, obj); } diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index 304b3f5a1..2206e640d 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -298,7 +298,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const VArc *arc = data->GeometricObject(tool.getId()); SCASSERT(arc != nullptr); - const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); + const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); return QString(tr("Arc with center in point %1")).arg(arcCenterName); } case Tool::SplinePathTool: diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index e94be27c1..c2bd32cd2 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -76,7 +76,9 @@ MainWindow::MainWindow(QWidget *parent) connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove); sceneDetails = new VMainGraphicsScene(); connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove); + view = new VMainGraphicsView(); + view->setDisabled(true); ui->LayoutView->addWidget(view); view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); @@ -1742,6 +1744,8 @@ void MainWindow::SetEnableWidgets(bool enable) ui->actionZoomOut->setEnabled(enable); ui->actionZoomFitBest->setEnabled(enable); ui->actionZoomOriginal->setEnabled(enable); + //Now we want allow user call context menu + view->setEnabled(enable); } //--------------------------------------------------------------------------------------------------------------------- @@ -2184,7 +2188,7 @@ MainWindow::~MainWindow() */ void MainWindow::LoadPattern(const QString &fileName) { - // Fit scene to view + // On this stage scene empty. Fit scene size to view size VAbstractTool::NewSceneRect(sceneDraw, view); VAbstractTool::NewSceneRect(sceneDetails, view); @@ -2244,6 +2248,7 @@ void MainWindow::LoadPattern(const QString &fileName) VAbstractTool::NewSceneRect(sceneDraw, view); VAbstractTool::NewSceneRect(sceneDetails, view); + //Fit scene size to best size for first show ActionDetails(true); view->ZoomFitBest(); diff --git a/src/app/widgets/vmaingraphicsscene.h b/src/app/widgets/vmaingraphicsscene.h index dae971fa0..d226f61ef 100644 --- a/src/app/widgets/vmaingraphicsscene.h +++ b/src/app/widgets/vmaingraphicsscene.h @@ -52,8 +52,8 @@ public slots: void ChoosedItem(quint32 id, const SceneObject &type); void SetFactor(qreal factor); protected: - void mouseMoveEvent(QGraphicsSceneMouseEvent* event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); signals: /** * @brief mouseMove send new mouse position.