Fix crash in history dialog.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-11 17:22:00 +03:00
parent b29778aa1a
commit 7ae44c600a
4 changed files with 10 additions and 4 deletions

View File

@ -536,6 +536,7 @@ QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &s
*/ */
void VContainer::UpdateGObject(quint32 id, VGObject* obj) void VContainer::UpdateGObject(quint32 id, VGObject* obj)
{ {
SCASSERT(obj != nullptr);
UpdateObject(gObjects, id, obj); UpdateObject(gObjects, id, obj);
} }

View File

@ -298,7 +298,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{ {
const VArc *arc = data->GeometricObject<const VArc *>(tool.getId()); const VArc *arc = data->GeometricObject<const VArc *>(tool.getId());
SCASSERT(arc != nullptr); SCASSERT(arc != nullptr);
const QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name(); const QString arcCenterName = data->GeometricObject<const VPointF *>(arc->GetCenter().id())->name();
return QString(tr("Arc with center in point %1")).arg(arcCenterName); return QString(tr("Arc with center in point %1")).arg(arcCenterName);
} }
case Tool::SplinePathTool: case Tool::SplinePathTool:

View File

@ -76,7 +76,9 @@ MainWindow::MainWindow(QWidget *parent)
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove); connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
sceneDetails = new VMainGraphicsScene(); sceneDetails = new VMainGraphicsScene();
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove); connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
view = new VMainGraphicsView(); view = new VMainGraphicsView();
view->setDisabled(true);
ui->LayoutView->addWidget(view); ui->LayoutView->addWidget(view);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
@ -1742,6 +1744,8 @@ void MainWindow::SetEnableWidgets(bool enable)
ui->actionZoomOut->setEnabled(enable); ui->actionZoomOut->setEnabled(enable);
ui->actionZoomFitBest->setEnabled(enable); ui->actionZoomFitBest->setEnabled(enable);
ui->actionZoomOriginal->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) 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(sceneDraw, view);
VAbstractTool::NewSceneRect(sceneDetails, view); VAbstractTool::NewSceneRect(sceneDetails, view);
@ -2244,6 +2248,7 @@ void MainWindow::LoadPattern(const QString &fileName)
VAbstractTool::NewSceneRect(sceneDraw, view); VAbstractTool::NewSceneRect(sceneDraw, view);
VAbstractTool::NewSceneRect(sceneDetails, view); VAbstractTool::NewSceneRect(sceneDetails, view);
//Fit scene size to best size for first show
ActionDetails(true); ActionDetails(true);
view->ZoomFitBest(); view->ZoomFitBest();

View File

@ -52,8 +52,8 @@ public slots:
void ChoosedItem(quint32 id, const SceneObject &type); void ChoosedItem(quint32 id, const SceneObject &type);
void SetFactor(qreal factor); void SetFactor(qreal factor);
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent* event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
signals: signals:
/** /**
* @brief mouseMove send new mouse position. * @brief mouseMove send new mouse position.