ui: Fixed font size in graph smaller on non MacOS systems

This commit is contained in:
Eberhard Graether
2015-11-26 00:13:58 +01:00
parent 6d8f733962
commit 9af08f4ff1
4 changed files with 20 additions and 1 deletions
+11
View File
@@ -1,6 +1,7 @@
#include "qt/view/QtGraphViewStyleImpl.h"
#include <QFontMetrics>
#include <QSysInfo>
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;
}
+1
View File
@@ -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
+7 -1
View File
@@ -76,10 +76,16 @@ void GraphViewStyle::setImpl(std::shared_ptr<GraphViewStyleImpl> 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();
@@ -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