Prior to this commit, the edge that was being dragged to be connected
appeared as soon as the `pressed` signal was emitted by the mouse. Now
that the user can actually click (press & release) without dragging the
mouse to expand or collapse groups, we want to be able to distinguish
cases where the user presses the mouse to click (to expand/collapse
groups) from those where the user presses the mouse to drag it (to
connect edges).
Instead of triggering the drag as soon as the `pressed` signal is
emitted, we wait to see if the mouse moves significantly enough to
indicate the will to drag; an arbitrary limit of 10 pixels along the
X- or Y-axis is used to determine that the user means to drag the mouse.
When edges could exist while being invisible in the graph, pins needed
to be enabled/disabled manually according to the visibility of the edge.
This was especially important when closing the application and removing
all the (hidden) edges as the pins needed to be properly destryed as well.
Edges are not hidden anymore, and any attribute that should be hidden
but is in fact connected remains visible as long as the connection exists.
Just like any other connected attribute, any child attribute within a
Group that is either the source or destination of an edge needs to remain
on display, independently from the status of its parent (collapsed or
expanded).
If an attribute belongs to a `GroupAttribute` or a `ListAttribute`,
it has a parent, and its full name is "parentName.attributeName".
Instead of displaying only "attributeName" in the tooltip, this commit
now displays "parentName.attributeName" to ensure that the link is obvious.
The callbacks of `childrenRepeater` (which was used to "fill"
`ListAttributes` with children) were not correctly set. Their prototypes
were missing the `index` argument, meaning that instead of being
provided with the child attribute that was added or deleted,
they were provided with its index in the model.
The added children attributes were also instatiated as empty attribute
pins that were still visible, thus increasing indirectly the spacing of
the initial pin.
This fixes the following QML warnings that may appear when performing
lots of operations on edges:
`Unable to assign [undefined] to QString/bool`
These warnings do not seem to have any functional impact on the connection
processes.
If attribute is disabled but has output connections, it becomes grey.
If the connection is removed while being disabled, it hides itself.
Both is working in GraphEditor on the nodes and in the AttributeEditor.
This commit effectively hides a node's attributes when they are disabled.
If these attributes have connections, the edges representing these
connections are hidden but not destroyed. When the edges are hidden, if
one of the connected attributes is still enabled, its pin becomes empty as
if it was not connected to anything.
If the disabled attribute is re-enabled and the connection has not been
broken (if the enabled attribute on the other side of the edge has not
been reconnected to another attribute, for example), the edge re-appears.
If the connection has been broken, then the attribute will be unconnected.
Hidden connections are saved in project files and taken into account when
a project file containing some is loaded.
This commit addresses warnings that were raised by QtCreator's linter:
- IDs declared more than once
- variables declared more than once in the same scope
- type coercions
- variables declared as "var" when their type is known
- unclosed "case" in switch-case
Moving the mouse rapidly when starting to connect two nodes'
attributes could lead to an unwanted offset between the tip of
the edge and the mouse's position; it forced the user to move
the mouse further than the attribute pin they wanted to connect
to in order to actually be able to connect to it.
* make Drag/DropArea overflow on the attribute's label to be more tolerant when connecting attributes
* add visual feedback when hovering interactive areas
* tweak spacings between attributes
* fix ListAttribute => ListAttribute with children (was breaking multiple simple connections to a ListAttribute)
* add missing case ListAttribute => Attribute