From da2cc857dffe342b38a99197313ce6a0ea13b6f5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 30 Sep 2017 21:13:22 +0300 Subject: [PATCH] Fix scaling point label. --HG-- branch : develop --- src/libs/vwidgets/global.cpp | 4 ++-- src/libs/vwidgets/vgraphicssimpletextitem.cpp | 7 +------ src/libs/vwidgets/vscenepoint.cpp | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/libs/vwidgets/global.cpp b/src/libs/vwidgets/global.cpp index d756ef74c..d2f1bddec 100644 --- a/src/libs/vwidgets/global.cpp +++ b/src/libs/vwidgets/global.cpp @@ -82,7 +82,7 @@ qreal ScaledRadius(qreal scale) qreal scaledRadius = defPointRadiusPixel; if (scale > 1) { - scaledRadius = qMax(defPointRadiusPixel/12, defPointRadiusPixel/scale); + scaledRadius = qMax(defPointRadiusPixel/96, defPointRadiusPixel/scale); } return scaledRadius; } @@ -100,7 +100,7 @@ qreal ScaleWidth(qreal width, qreal scale) { if (scale > 1) { - width = qMax(0.1, width/scale); + width = qMax(0.01, width/scale); } return width; } diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 878f2ab96..2b9b70720 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -85,16 +85,11 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphic void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { const qreal scale = SceneScale(scene()); - qreal fontSize = BaseFontSize(); if (scale > 1) { - fontSize = qMax(0.1, fontSize/scale); + setScale(1/scale); } - QFont font = this->font(); - font.setPointSizeF(fontSize); - setFont(font); - QGraphicsSimpleTextItem::paint(painter, option, widget); } diff --git a/src/libs/vwidgets/vscenepoint.cpp b/src/libs/vwidgets/vscenepoint.cpp index 60701fb8c..9aa6f200a 100644 --- a/src/libs/vwidgets/vscenepoint.cpp +++ b/src/libs/vwidgets/vscenepoint.cpp @@ -63,7 +63,7 @@ void VScenePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio { const qreal scale = SceneScale(scene()); - if (m_namePoint->BaseFontSize()*scale < 1) + if (m_namePoint->BaseFontSize()*scale < 5) { m_namePoint->setVisible(false); m_lineName->setVisible(false);