ui: Graph legend (issue #308, #540)

* Show graph legend via 'legend' command or '?' button in the lower right corner
* Legend is not interactive: nodes and edges not clickable or moveable
* CXX and Java node types are mixed
This commit is contained in:
Eberhard Graether
2018-07-23 16:55:58 +02:00
parent 83873f4dbf
commit ed0ade034e
42 changed files with 768 additions and 246 deletions
+13 -9
View File
@@ -1,22 +1,19 @@
#include "qt/view/QtGraphViewStyleImpl.h"
#include <QFont>
#include <QFontMetrics>
#include "qt/view/graphElements/QtGraphNode.h"
#include "component/view/GraphViewStyle.h"
#include "utility/utilityApp.h"
QtGraphViewStyleImpl::~QtGraphViewStyleImpl()
float QtGraphViewStyleImpl::getCharWidth(const std::string& fontName, size_t fontSize)
{
return QFontMetrics(getFontForStyleType(fontName, fontSize)).width("QtGraphNode::QtGraphNode::QtGraphNode") / 37.0f;
}
float QtGraphViewStyleImpl::getCharWidth(NodeType::StyleType type)
float QtGraphViewStyleImpl::getCharHeight(const std::string& fontName, size_t fontSize)
{
return QFontMetrics(QtGraphNode::getFontForStyleType(type)).width("QtGraphNode::QtGraphNode::QtGraphNode") / 37.0f;
}
float QtGraphViewStyleImpl::getCharHeight(NodeType::StyleType type)
{
return QFontMetrics(QtGraphNode::getFontForStyleType(type)).height();
return QFontMetrics(getFontForStyleType(fontName, fontSize)).height();
}
float QtGraphViewStyleImpl::getGraphViewZoomDifferenceForPlatform()
@@ -28,3 +25,10 @@ float QtGraphViewStyleImpl::getGraphViewZoomDifferenceForPlatform()
return 1.25;
}
QFont QtGraphViewStyleImpl::getFontForStyleType(const std::string& fontName, size_t fontSize) const
{
QFont font(fontName.c_str());
font.setPixelSize(fontSize);
return font;
}