From 9af08f4ff1050792330b66dc3b1181c4b22b3138 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 26 Nov 2015 00:13:58 +0100 Subject: [PATCH] ui: Fixed font size in graph smaller on non MacOS systems --- src/app/qt/view/QtGraphViewStyleImpl.cpp | 11 +++++++++++ src/app/qt/view/QtGraphViewStyleImpl.h | 1 + src/lib/component/view/GraphViewStyle.cpp | 8 +++++++- src/lib/component/view/GraphViewStyleImpl.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/app/qt/view/QtGraphViewStyleImpl.cpp b/src/app/qt/view/QtGraphViewStyleImpl.cpp index 016a76b5..9d8dad40 100644 --- a/src/app/qt/view/QtGraphViewStyleImpl.cpp +++ b/src/app/qt/view/QtGraphViewStyleImpl.cpp @@ -1,6 +1,7 @@ #include "qt/view/QtGraphViewStyleImpl.h" #include +#include QtGraphViewStyleImpl::~QtGraphViewStyleImpl() { @@ -15,3 +16,13 @@ float QtGraphViewStyleImpl::getCharHeightForNodeType(Node::NodeType type) { return QFontMetrics(QtGraphNode::getFontForNodeType(type)).height(); } + +float QtGraphViewStyleImpl::getGraphViewZoomDifferenceForPlatform() +{ + if (QSysInfo::macVersion() == QSysInfo::MV_None) + { + return 1.25; + } + + return 1; +} diff --git a/src/app/qt/view/QtGraphViewStyleImpl.h b/src/app/qt/view/QtGraphViewStyleImpl.h index 8ea76ae7..7de99487 100644 --- a/src/app/qt/view/QtGraphViewStyleImpl.h +++ b/src/app/qt/view/QtGraphViewStyleImpl.h @@ -11,6 +11,7 @@ public: virtual ~QtGraphViewStyleImpl(); virtual float getCharWidthForNodeType(Node::NodeType type); virtual float getCharHeightForNodeType(Node::NodeType type); + virtual float getGraphViewZoomDifferenceForPlatform(); }; #endif // QT_GRAPH_VIEW_STYLE_IMPL_H diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp index d5c9d0e7..51edc65e 100644 --- a/src/lib/component/view/GraphViewStyle.cpp +++ b/src/lib/component/view/GraphViewStyle.cpp @@ -76,10 +76,16 @@ void GraphViewStyle::setImpl(std::shared_ptr impl) void GraphViewStyle::loadStyleSettings() { + if (!s_impl) + { + return; + } + s_fontSize = 14; s_fontName = ApplicationSettings::getInstance()->getFontName(); - s_zoomFactor = ApplicationSettings::getInstance()->getFontSize() / float(s_fontSize); + float zoomDifference = getImpl()->getGraphViewZoomDifferenceForPlatform(); + s_zoomFactor = (ApplicationSettings::getInstance()->getFontSize()) / float(s_fontSize) * zoomDifference; s_charWidths.clear(); s_charHeights.clear(); diff --git a/src/lib/component/view/GraphViewStyleImpl.h b/src/lib/component/view/GraphViewStyleImpl.h index a38b7930..e57a6421 100644 --- a/src/lib/component/view/GraphViewStyleImpl.h +++ b/src/lib/component/view/GraphViewStyleImpl.h @@ -9,6 +9,7 @@ public: virtual ~GraphViewStyleImpl() { } virtual float getCharWidthForNodeType(Node::NodeType type) = 0; virtual float getCharHeightForNodeType(Node::NodeType type) = 0; + virtual float getGraphViewZoomDifferenceForPlatform() = 0; }; #endif // GRAPH_VIEW_STYLE_IMPL_H