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
+15 -1
View File
@@ -20,6 +20,7 @@
#include "qt/utility/QtFileDialog.h"
#include "qt/utility/utilityQt.h"
#include "settings/ApplicationSettings.h"
#include "utility/messaging/type/activation/MessageActivateLegend.h"
#include "utility/messaging/type/code/MessageCodeShowDefinition.h"
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
#include "utility/messaging/type/MessageGraphNodeHide.h"
@@ -102,6 +103,12 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
m_zoomOutButton->setAutoRepeat(true);
m_zoomOutButton->setToolTip("Zoom out (" + modifierName + " + Mousewheel back)");
connect(m_zoomOutButton, &QPushButton::pressed, this, &QtGraphicsView::zoomOutPressed);
m_legendButton = new QtSelfRefreshIconButton(
"", ResourcePaths::getGuiPath().concatenate(L"graph_view/images/legend.png"), "search/button", this);
m_legendButton->setObjectName("legend_button");
m_legendButton->setToolTip("Show graph legend");
connect(m_legendButton, &QPushButton::clicked, this, &QtGraphicsView::legendClicked);
}
float QtGraphicsView::getZoomFactor() const
@@ -201,10 +208,12 @@ void QtGraphicsView::resizeEvent(QResizeEvent* event)
{
m_zoomState->setGeometry(QRect(31, event->size().height() - 27, 65, 19));
m_zoomInButton->setGeometry(QRect(8, event->size().height() - 50, 19, 19));
m_zoomOutButton->setGeometry(QRect(8, event->size().height() - 27, 19, 19));
m_zoomOutButton->setGeometry(QRect(8, event->size().height() - 27, 18, 19));
m_legendButton->setGeometry(QRect(event->size().width() - 24, event->size().height() - 24, 18, 18));
m_zoomInButton->setIconSize(QSize(15, 15));
m_zoomOutButton->setIconSize(QSize(15, 15));
m_legendButton->setIconSize(QSize(10, 10));
emit resized();
}
@@ -567,6 +576,11 @@ void QtGraphicsView::hideZoomLabel()
m_zoomState->hide();
}
void QtGraphicsView::legendClicked()
{
MessageActivateLegend().dispatch();
}
bool QtGraphicsView::moves() const
{
return m_up || m_down || m_left || m_right;
+4
View File
@@ -67,6 +67,8 @@ private slots:
void hideZoomLabel();
void legendClicked();
private:
bool moves() const;
@@ -104,6 +106,8 @@ private:
QtSelfRefreshIconButton* m_zoomInButton;
QtSelfRefreshIconButton* m_zoomOutButton;
QtSelfRefreshIconButton* m_legendButton;
float m_zoomInButtonSpeed;
float m_zoomOutButtonSpeed;
};