From 6dfe04e2bcfead8c81e7f2dd91a3e1f8965aef17 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 26 Oct 2017 22:59:28 +0300 Subject: [PATCH] Fixing issue with slow zooming. Check if need to update scene rect before actual update. --HG-- branch : develop --- src/libs/vwidgets/vgraphicssimpletextitem.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 8ee391c2b..bde8182d4 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -48,8 +48,6 @@ #include "global.h" #include "vscenepoint.h" -#define DEFAULT_SCALE 0.01 - //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGraphicsSimpleTextItem default constructor. @@ -57,7 +55,7 @@ */ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent) :QGraphicsSimpleTextItem(parent), m_fontSize(0), selectionType(SelectionType::ByMouseRelease), - m_oldScale(DEFAULT_SCALE) + m_oldScale(VMainGraphicsView::MinScale()) { this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -79,7 +77,7 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent) */ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent ) :QGraphicsSimpleTextItem(text, parent), m_fontSize(0), selectionType(SelectionType::ByMouseRelease), - m_oldScale(DEFAULT_SCALE) + m_oldScale(VMainGraphicsView::MinScale()) { this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -118,7 +116,7 @@ void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphic m_oldScale = 1; } - if (scene) + if (scene && not scene->sceneRect().contains(sceneBoundingRect())) { if (QGraphicsView *view = scene->views().at(0)) {