From cacba00e8342552bae3efb22ff6d3ccf7c4dc096 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 23 Jun 2017 16:02:59 +0300 Subject: [PATCH] Zoom fit best current did not work properly because of corrupted point. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 2 +- src/libs/vwidgets/vscenepoint.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 7086abab6..972fbb1b8 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -4653,7 +4653,7 @@ void MainWindow::ZoomFirstShow() { ActionDraw(true); } - ui->view->ZoomFitBest(); + ZoomFitBestCurrent(); VMainGraphicsView::NewSceneRect(sceneDraw, ui->view); VMainGraphicsView::NewSceneRect(sceneDetails, ui->view); diff --git a/src/libs/vwidgets/vscenepoint.cpp b/src/libs/vwidgets/vscenepoint.cpp index 18ccf953a..1294845c6 100644 --- a/src/libs/vwidgets/vscenepoint.cpp +++ b/src/libs/vwidgets/vscenepoint.cpp @@ -49,6 +49,9 @@ VScenePoint::VScenePoint(QGraphicsItem *parent) m_namePoint = new VGraphicsSimpleTextItem(this); m_lineName = new VScaledLine(this); m_lineName->SetBasicWidth(widthHairLine); + m_lineName->setLine(QLineF(0, 0, 1, 0)); + m_lineName->setVisible(false); + this->setBrush(QBrush(Qt::NoBrush)); this->setAcceptHoverEvents(true); this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus @@ -72,7 +75,6 @@ void VScenePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio if (not m_onlyPoint) { m_namePoint->setVisible(true); - m_lineName->setVisible(true); QPen lPen = m_lineName->pen(); lPen.setColor(CorrectColor(m_lineName, Qt::black)); @@ -141,7 +143,6 @@ void VScenePoint::RefreshLine() VGObject::LineIntersectCircle(QPointF(), ScaledRadius(SceneScale(scene())), QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2); const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); - m_lineName->setLine(QLineF(p1, pRec - scenePos())); if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm)) { @@ -149,6 +150,7 @@ void VScenePoint::RefreshLine() } else { + m_lineName->setLine(QLineF(p1, pRec - scenePos())); m_lineName->setVisible(true); } }