Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def configureDoxyfile(input_dir, output_dir):
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [ "breathe", "sphinx_rtd_theme" ]
extensions = [ "breathe", "sphinx_rtd_theme", "sphinxcontrib.mermaid" ]


#Breathe configuration
Expand Down
17 changes: 14 additions & 3 deletions docs/guide/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ Update at runtime:
Resizable Nodes
---------------

Allow users to resize nodes (useful for embedded widgets):
Allow users to resize nodes (useful for embedded widgets). A resizable node shows a resize
handle. The handle resizes the embedded widget, and the node follows its widget:

.. code-block:: cpp

Expand All @@ -131,20 +132,30 @@ Allow users to resize nodes (useful for embedded widgets):
return NodeFlag::Resizable;
}

Handle size changes:
The scene computes the size of a node from its content: the widget, the caption, the label and
the ports. It stores the result with ``setNodeData(nodeId, NodeRole::Size, size)``. Your model
must store this value and return it. It is an output of the layout and not a setting. A value
that you set from code does not resize the node, and the next ``nodeUpdated`` replaces it. To
make a node bigger, resize its embedded widget. If the delegate resizes the widget itself, it
emits ``embeddedWidgetSizeUpdated()`` afterwards.

Store the size:

.. code-block:: cpp

bool MyModel::setNodeData(NodeId nodeId, NodeRole role, QVariant value) override
{
if (role == NodeRole::Size) {
_nodeSizes[nodeId] = value.toSize();
emit nodeUpdated(nodeId);
return true;
}
// ...
}

Do not emit ``nodeUpdated`` when ``Size`` is set. The scene sets ``Size`` while it handles
``nodeUpdated``, so the signal would start an endless recursion. See
:doc:`change-notifications` for the signals that a model must emit.

Non-Detachable Connections
--------------------------

Expand Down
Loading
Loading