ui: graph transitions

This change adds animated transitions to the QtGraphView using sequential and parallel animations. First vanishing nodes
and all edges get faded out, then the remaining nodes are moved and resized, lastly new nodes and all edges are faded in.

fortune cookie message = Sorge dich nicht! Du wirst bekommen, was du brauchst.
This commit is contained in:
Eberhard Graether
2015-02-23 12:11:01 +01:00
parent 35867c17af
commit 4f7d31eb79
14 changed files with 426 additions and 65 deletions
+45 -3
View File
@@ -9,10 +9,29 @@
#include "qt/graphics/QtGraphicsRoundedRectItem.h"
#include "qt/utility/QtDeviceScaledPixmap.h"
#include "qt/utility/QtGraphPostprocessor.h"
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
#include "qt/view/graphElements/QtGraphEdge.h"
void QtGraphNode::blendIn()
{
setOpacity(1.0f);
}
void QtGraphNode::blendOut()
{
setOpacity(0.0f);
}
void QtGraphNode::showNode()
{
this->show();
}
void QtGraphNode::hideNode()
{
this->hide();
}
QFont QtGraphNode::getFontForNodeType(Node::NodeType type)
{
QFont font("Source Code Pro");
@@ -92,6 +111,11 @@ void QtGraphNode::setName(const std::string& name)
m_text->setText(QString::fromStdString(name));
}
bool QtGraphNode::isAccessNode() const
{
return false;
}
Vec2i QtGraphNode::getPosition() const
{
return Vec2i(this->scenePos().x(), this->scenePos().y());
@@ -205,6 +229,16 @@ unsigned int QtGraphNode::getInEdgeCount() const
return m_inEdges.size();
}
QSize QtGraphNode::size() const
{
return QSize(m_size.x, m_size.y);
}
void QtGraphNode::setSize(const QSize& size)
{
setSize(Vec2i(size.width(), size.height()));
}
bool QtGraphNode::getIsActive() const
{
return m_isActive;
@@ -394,6 +428,16 @@ void QtGraphNode::setStyle()
m_text->setPos(padding.x, padding.y);
}
void QtGraphNode::setShadowEnabledRecursive(bool enabled)
{
m_rect->setShadowEnabled(enabled);
for (const std::shared_ptr<QtGraphNode>& node : m_subNodes)
{
node->setShadowEnabledRecursive(enabled);
}
}
void QtGraphNode::onClick()
{
if (m_data && !m_data->isType(Node::NODE_UNDEFINED | Node::NODE_NAMESPACE))
@@ -468,8 +512,6 @@ void QtGraphNode::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
parent->mouseReleaseEvent(event);
}
}
QtGraphPostprocessor::allignNodeOnRaster(this);
}
void QtGraphNode::hoverEnterEvent(QGraphicsSceneHoverEvent* event)