cisst-saw
Loading...
Searching...
No Matches
mtsComponentModelQtNodes.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5 Author(s): Anton Deguet
6 Created on: 2025-10-28
7
8 (C) Copyright 2025-2026 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19#ifndef _mtsComponentModelQtNodes_h
20#define _mtsComponentModelQtNodes_h
21
22#include <cisstConfig.h>
23#if !CISST_HAS_QTNODES
24#error "mtsComponentModelQtNodes.h requires CISST_HAS_QTNODES"
25#endif
26
27#include <QtNodes/NodeDelegateModel>
28
29// Always include last
31
33 : public QtNodes::NodeDelegateModel {
34 Q_OBJECT
35
36 public:
37 mtsComponentModelQtNodes(const std::string &processName,
38 const std::string &componentName,
39 const std::string &className,
40 const QColor &color = QColor());
42
43 // NodeDelegateModel interface
44 QString caption(void) const override;
45 bool captionVisible(void) const override;
46 QString name(void) const override;
47
48 unsigned int nPorts(QtNodes::PortType portType) const override;
49
50 QtNodes::NodeDataType dataType(QtNodes::PortType portType,
51 QtNodes::PortIndex portIndex) const override;
52
53 QString portCaption(QtNodes::PortType portType,
54 QtNodes::PortIndex portIndex) const override;
55
56 bool portCaptionVisible(QtNodes::PortType portType,
57 QtNodes::PortIndex portIndex) const override;
58
59 void setInData(std::shared_ptr<QtNodes::NodeData> nodeData,
60 QtNodes::PortIndex port) override;
61
62 std::shared_ptr<QtNodes::NodeData> outData(QtNodes::PortIndex port) override;
63
64 QWidget *embeddedWidget(void) override;
65
66 QJsonObject save() const override;
67
68 bool AddInterfaceProvided(const std::string &name);
69 bool AddInterfaceRequired(const std::string &name);
70 void SetState(const std::string &state);
71
72 protected:
73 void UpdateWidget(void);
74
75 std::string m_processName;
76 std::string m_componentName;
77 std::string m_state;
78 std::string m_className;
79 std::vector<std::string> m_interfaces_provided;
80 std::vector<std::string> m_interfaces_required;
81 QWidget *m_widget = nullptr;
82 QColor m_color;
83};
84
85#endif // _mtsComponentModelQtNodes_h
QString name(void) const override
std::string m_componentName
Definition mtsComponentModelQtNodes.h:76
QJsonObject save() const override
QColor m_color
Definition mtsComponentModelQtNodes.h:82
std::string m_processName
Definition mtsComponentModelQtNodes.h:75
QWidget * m_widget
Definition mtsComponentModelQtNodes.h:81
bool captionVisible(void) const override
std::string m_className
Definition mtsComponentModelQtNodes.h:78
QWidget * embeddedWidget(void) override
bool AddInterfaceProvided(const std::string &name)
bool AddInterfaceRequired(const std::string &name)
unsigned int nPorts(QtNodes::PortType portType) const override
QString portCaption(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override
bool portCaptionVisible(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override
mtsComponentModelQtNodes(const std::string &processName, const std::string &componentName, const std::string &className, const QColor &color=QColor())
std::vector< std::string > m_interfaces_provided
Definition mtsComponentModelQtNodes.h:79
void SetState(const std::string &state)
std::vector< std::string > m_interfaces_required
Definition mtsComponentModelQtNodes.h:80
void setInData(std::shared_ptr< QtNodes::NodeData > nodeData, QtNodes::PortIndex port) override
QString caption(void) const override
std::shared_ptr< QtNodes::NodeData > outData(QtNodes::PortIndex port) override
std::string m_state
Definition mtsComponentModelQtNodes.h:77
QtNodes::NodeDataType dataType(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override
~mtsComponentModelQtNodes()=default
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Rules of exporting.