ui: Fixed font size in graph smaller on non MacOS systems
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user