Skip to content
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

Add qml #449

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0aa87ed
Fix CMake warnings
bansan85 Oct 17, 2023
94be995
Fix MSVC warnings
bansan85 Oct 17, 2023
c96829b
Add calculator_test
bansan85 Oct 21, 2024
5bf9066
Missing MultiplicationModel.hpp in CMakeLists.txt
bansan85 Oct 23, 2023
c51ebc3
Minors fixes in library
bansan85 Oct 24, 2023
8c6b9fc
Apply clang-format
bansan85 Oct 21, 2024
285ebc9
Remove qml debug messages
bansan85 Oct 21, 2024
dc79eaf
IWYU qml
bansan85 Oct 21, 2024
31a267e
IWYU
bansan85 Oct 21, 2024
05752dd
Avoid overlap between connections and nodes
bansan85 Nov 3, 2023
144a7eb
Add Acquisition Viewer
bansan85 Oct 21, 2024
c755681
Fix Dynamic ports example
bansan85 Nov 6, 2023
671b4c4
Add Compute viewer that embedded parameters
bansan85 Oct 21, 2024
9639b52
Fix Load / Save for Acquisition Viewer
bansan85 Nov 7, 2023
0ea5f78
Implement full compute_viewer
bansan85 Oct 21, 2024
9860f83
Call WINDEPLOYQT_EXECUTABLE for all example
bansan85 Nov 8, 2023
4f8f543
Don't skip default action for mouse event
bansan85 Nov 10, 2023
ef934e0
Use ResultWidget
bansan85 Oct 21, 2024
2941a32
Add images for examples
bansan85 Nov 15, 2023
c650806
Add package init in Config.cmake.in
bansan85 Jan 24, 2024
cc44a1c
Fix examples Win static build
bansan85 Oct 21, 2024
ee0860d
Fix format and dedicated CI
bansan85 Oct 21, 2024
7290349
Remove openGL dependency
bansan85 Jun 26, 2024
7cc0759
Fix CI and reduce dependencies
bansan85 Oct 21, 2024
a70646d
Fix usage of dataInvalidated
bansan85 Oct 21, 2024
0888da8
Fix typos
bansan85 Jun 26, 2024
a195372
setPortData should return true if success
bansan85 Jun 27, 2024
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
29 changes: 24 additions & 5 deletions examples/acquisition_viewer/AcqModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ QWidget *AcqModel::embeddedWidget()

_result = std::make_shared<AcqData>();

bool ok;
if (_title.isEmpty()) {
bool ok;

QString text
= QInputDialog::getText(nullptr, "Acquisition node", "Title:", QLineEdit::Normal, "", &ok);
if (ok && !text.isEmpty())
_title = text;
QString text = QInputDialog::getText(nullptr,
"Acquisition node",
"Title:",
QLineEdit::Normal,
"",
&ok);
if (ok && !text.isEmpty())
_title = text;
}

NodeStyle style;
style.GradientColor0 = {rand() % 256, rand() % 256, rand() % 256};
Expand All @@ -63,3 +69,16 @@ QWidget *AcqModel::embeddedWidget()

return nullptr;
}

QJsonObject AcqModel::save() const
{
QJsonObject retval = NodeDelegateModel::save();
retval["Title"] = _title;
return retval;
}

void AcqModel::load(QJsonObject const &object)
{
NodeDelegateModel::load(object);
_title = object["Title"].toString();
}
4 changes: 4 additions & 0 deletions examples/acquisition_viewer/AcqModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class AcqModel : public NodeDelegateModel
return ConnectionPolicy::Many;
}

QJsonObject save() const override;

void load(QJsonObject const &) override;

private:
std::shared_ptr<AcqData> _result;
QString _title;
Expand Down
171 changes: 171 additions & 0 deletions examples/acquisition_viewer/sample.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
{
"connections": [
{
"inPortIndex": 0,
"intNodeId": 4,
"outNodeId": 3,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 2,
"outNodeId": 3,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 6,
"outNodeId": 5,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 3,
"outNodeId": 2,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 1,
"outNodeId": 3,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 7,
"outNodeId": 6,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 3,
"outNodeId": 1,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 5,
"outNodeId": 4,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 8,
"outNodeId": 7,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 9,
"outNodeId": 8,
"outPortIndex": 0
},
{
"inPortIndex": 0,
"intNodeId": 3,
"outNodeId": 9,
"outPortIndex": 0
}
],
"nodes": [
{
"id": 1,
"internal-data": {
"Title": "HD2",
"model-name": "Acquisition"
},
"position": {
"x": 160,
"y": -34
}
},
{
"id": 2,
"internal-data": {
"Title": "Ultrafast",
"model-name": "Acquisition"
},
"position": {
"x": 118,
"y": 206
}
},
{
"id": 3,
"internal-data": {
"Title": "BMode-25Hz",
"model-name": "Acquisition"
},
"position": {
"x": -33,
"y": 159
}
},
{
"id": 4,
"internal-data": {
"Title": "Push #1",
"model-name": "Acquisition"
},
"position": {
"x": 257,
"y": 160
}
},
{
"id": 5,
"internal-data": {
"Title": "Imaging #1",
"model-name": "Acquisition"
},
"position": {
"x": 380,
"y": 159
}
},
{
"id": 6,
"internal-data": {
"Title": "Push #2",
"model-name": "Acquisition"
},
"position": {
"x": 516,
"y": 159
}
},
{
"id": 7,
"internal-data": {
"Title": "Imaging #2",
"model-name": "Acquisition"
},
"position": {
"x": 634,
"y": 160
}
},
{
"id": 8,
"internal-data": {
"Title": "Push #3",
"model-name": "Acquisition"
},
"position": {
"x": 769,
"y": 160
}
},
{
"id": 9,
"internal-data": {
"Title": "Imaging #3",
"model-name": "Acquisition"
},
"position": {
"x": 892,
"y": 159
}
}
]
}
3 changes: 1 addition & 2 deletions src/DataFlowGraphModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ void DataFlowGraphModel::loadNode(QJsonObject const &nodeJson)
onOutPortDataUpdated(restoredNodeId, portIndex);
});

model->load(internalDataJson);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember why but QtNodes crashes with _models[restoredNodeId]->load(internalDataJson);.

_models[restoredNodeId] = std::move(model);

Q_EMIT nodeCreated(restoredNodeId);
Expand All @@ -493,8 +494,6 @@ void DataFlowGraphModel::loadNode(QJsonObject const &nodeJson)
QPointF const pos(posJson["x"].toDouble(), posJson["y"].toDouble());

setNodeData(restoredNodeId, NodeRole::Position, pos);

_models[restoredNodeId]->load(internalDataJson);
} else {
throw std::logic_error(std::string("No registered model with name ")
+ delegateModelName.toLocal8Bit().data());
Expand Down