nodeview: make auto-position a manual and specific function, allow different flow directions

The first in many NodeView improvements. Up until now, nodes have been forcibly
auto-arranged, which has worked as a reasonable stop-gap just so that all the
nodes are visible during testing/development. However this does not make a good
user experience.

We move the auto-arrange code to a manual function that can be used when the
user or program deems it necessary, and also abstract the node positions so that
the view can ultimately determine the exact amount of spacing (useful for
changing DPIs) or orientation, so users can direct the flow whichever way they
want.
This commit is contained in:
itsmattkc
2020-04-28 00:28:38 +10:00
parent 3e28c74d20
commit e154b5d5d4
8 changed files with 124 additions and 51 deletions
+7
View File
@@ -46,6 +46,9 @@ class NodeViewItem : public QGraphicsRectItem
public:
NodeViewItem(QGraphicsItem* parent = nullptr);
QPointF GetNodePosition() const;
void SetNodePosition(const QPointF& pos);
/**
* @brief Set the Node to correspond to this widget
*/
@@ -85,6 +88,10 @@ public:
static int DefaultItemBorder();
qreal DefaultItemHorizontalPadding() const;
qreal DefaultItemVerticalPadding() const;
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;