-
Notifications
You must be signed in to change notification settings - Fork 929
Add Node Processing Status feature #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tatatupi
merged 35 commits into
paceholder:master
from
fabns-nano:node_processing_status
Dec 5, 2025
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
2edfb0b
Updates fork from upstream
tatatupi 988ce45
wip: adds NodeValidationState info to NodeDelegateModel
tatatupi 1c84750
makes the nodeObject red in case of invalid state and adds a tooltip …
tatatupi 3007c23
adds warning state and adapts calculator example
tatatupi 129d414
adds validation icon and adapts calculation example
tatatupi e0b0c4a
core improvements to develop node processing status
g-abilio e002f5b
first commit on the creation of a processing status example
g-abilio 985b638
fixes nodeprocessingstatus cast
tatatupi 3f55e35
creation of random gen example, and fix of icon color
g-abilio 50c6bec
Connect delegate UI update signal
tatatupi 1c09ecf
fix random number node dynamic
g-abilio 50ce760
Merge pull request #5 from fabns-nano/codex/add-signal-for-ui-updates…
g-abilio f2c120f
clean up test code in multiplication node
g-abilio 97d48d5
Merge branch 'paceholder:master' into master
tatatupi 89ac7f2
Merge branch 'master' of https://github.com/paceholder/nodeeditor
tatatupi 37c3bf8
solves conflict
tatatupi b23ecc3
revert unnecessary changes in multiplication model
tatatupi 0a35f76
revert unnecessary changes
tatatupi a9be092
solve icon size and refactor NodeProcessingStatus code
g-abilio 5530b72
update and merge new code
g-abilio 03e311a
remove duplicate code
g-abilio a87ceb2
add space to better organize processing status in node display
g-abilio ae3715b
remove processing value default value
g-abilio eedc666
fix bugs in node processing status
g-abilio 1298605
add Q_DECLARE_METATYPE to solve linux build problems
g-abilio 47d948f
declaring metatype in the correct place
g-abilio 67a191d
uniformizes icon files attributes
tatatupi a41ce83
removes commented code
tatatupi 97c0c94
improves processing status icon resolution
tatatupi 0156e5f
solves situations where icons should not appear
g-abilio 8832922
adds docstring to each nodeprocessingstatus
g-abilio 582cc45
adds possibility to change the node processing status icon style
tatatupi e73aaf4
moves all status logic to NodeStyle
tatatupi 89eb02f
removes unnecessary code
tatatupi 90ccd88
adds declaration of QPixmap
tatatupi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #pragma once | ||
|
|
||
| #include <QtNodes/NodeDelegateModel> | ||
| #include <QTimer> | ||
| #include <QtCore/QObject> | ||
| #include <QtWidgets/QLabel> | ||
| #include <QtCore/QRandomGenerator64> | ||
|
|
||
| #include "MathOperationDataModel.hpp" | ||
| #include "DecimalData.hpp" | ||
|
|
||
| /// The model generates a random value in a long processing schema, | ||
| /// as it should demonstrate the usage of the NodeProcessingStatus. | ||
| /// The random number is generate in the [n1, n2] interval. | ||
| class RandomNumberModel : public MathOperationDataModel | ||
| { | ||
| public: | ||
| RandomNumberModel() { | ||
| this->setNodeProcessingStatus(QtNodes::NodeProcessingStatus::Empty); | ||
|
|
||
|
|
||
| QObject::connect(this, &NodeDelegateModel::computingStarted, this, [this]() { | ||
| if (_number1.lock() && _number2.lock()) { | ||
| this->setNodeProcessingStatus( | ||
| QtNodes::NodeProcessingStatus::Processing); | ||
| } | ||
|
|
||
| emit requestNodeUpdate(); | ||
| }); | ||
| QObject::connect(this, &NodeDelegateModel::computingFinished, this, [this]() { | ||
| this->setNodeProcessingStatus( | ||
| QtNodes::NodeProcessingStatus::Updated); | ||
|
|
||
| emit requestNodeUpdate(); | ||
| }); | ||
| } | ||
| virtual ~RandomNumberModel() {} | ||
|
|
||
| public: | ||
| QString caption() const override { return QStringLiteral("Random Number"); } | ||
|
|
||
| QString name() const override { return QStringLiteral("Random Number"); } | ||
|
|
||
| private: | ||
| void compute() override | ||
| { | ||
| Q_EMIT computingStarted(); | ||
| PortIndex const outPortIndex = 0; | ||
|
|
||
| auto n1 = _number1.lock(); | ||
| auto n2 = _number2.lock(); | ||
|
|
||
| QTimer *timer = new QTimer(this); | ||
| timer->start(1000); | ||
| int secondsRemaining = 3; | ||
| connect(timer, &QTimer::timeout, this, [=]() mutable { | ||
| if (--secondsRemaining <= 0) { | ||
| timer->stop(); | ||
| if (n1 && n2) { | ||
| double a = n1->number(); | ||
| double b = n2->number(); | ||
|
|
||
| if (a > b) { | ||
| setNodeProcessingStatus(QtNodes::NodeProcessingStatus::Failed); | ||
|
|
||
| emit requestNodeUpdate(); | ||
| return; | ||
| } | ||
|
|
||
| double upper = std::nextafter(b, std::numeric_limits<double>::max()); | ||
| double randomValue = QRandomGenerator::global()->generateDouble() * (upper - a) + a; | ||
|
|
||
| _result = std::make_shared<DecimalData>(randomValue); | ||
| Q_EMIT computingFinished(); | ||
| } else { | ||
| _result.reset(); | ||
| } | ||
|
|
||
| Q_EMIT dataUpdated(outPortIndex); | ||
| } | ||
| }); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| #pragma once | ||
|
|
||
| #include <QIcon> | ||
| #include <QtCore/QUuid> | ||
| #include <QtWidgets/QGraphicsObject> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some use-cases or a short comment could help others?
What is the difference between
NoStatusandEmpty?Between
ProcessingandPartial?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The short comments have been added. Thanks for the suggestion!
NoStatus indicates the absence of a processing status for the node in the UI. Empty means that there is no valid input data and therefore nothing to compute.
Processing means that processing is in progress. Partial means that the computation was finished incompletely and only partial results are available.