#ifndef FLOWGRAPHNODEWIDGET_H #define FLOWGRAPHNODEWIDGET_H #include class QLabel; class QCheckBox; class QComboBox; class QSpinBox; class QVBoxLayout; class FlowGraphNodeWidget : public QWidget { Q_OBJECT public: enum NodeWidgetType { Plain, CheckBox, ComboBox, SpinBox, }; explicit FlowGraphNodeWidget(NodeWidgetType type, QWidget *parent = nullptr); NodeWidgetType type() const; signals: protected: NodeWidgetType m_type = Plain; QVBoxLayout *m_layout = nullptr; }; class FlowGraphPlainNodeWidget : public FlowGraphNodeWidget { Q_OBJECT public: explicit FlowGraphPlainNodeWidget(QWidget *parent = nullptr); void setText(const QString text); private: QLabel *m_label = nullptr; }; class FlowGraphCheckNodeWidget : public FlowGraphNodeWidget { Q_OBJECT public: explicit FlowGraphCheckNodeWidget(QWidget *parent = nullptr); private: QCheckBox *m_checkBox = nullptr; }; class FlowGraphComboNodeWidget : public FlowGraphNodeWidget { Q_OBJECT public: explicit FlowGraphComboNodeWidget(QWidget *parent = nullptr); QList items() const; void setItems(QList items); private: QComboBox *m_combo = nullptr; QList m_items; }; class FlowGraphSpinNodeWidget : public FlowGraphNodeWidget { Q_OBJECT public: explicit FlowGraphSpinNodeWidget(QWidget *parent = nullptr); private: QSpinBox *m_spinBox = nullptr; }; #include class FlowGraphCommonNodeWidget : public QWidget { Q_OBJECT public: explicit FlowGraphCommonNodeWidget(QWidget *parent = nullptr); SchemePlanManager::SchemeProcessInfo process() const; void setProcess(SchemePlanManager::SchemeProcessInfo &i); void setProcessId(int id); bool isTitleHidden() const; void setAllowEdit(bool allow); signals: void sigProcessEdited(SchemePlanManager::SchemeProcessInfo process); protected: void initWidget(); void connectSignalsAndSlots(); void loadInfo(); QString title() const; QList optionalAlgs() const; QList optionaldSource() const; bool isOptional() const; protected slots: void slotAlgComboChanged(int index); void slotDataComboChanged(int index); void slotSpinBoxChanged(int value); void slotCheckBoxChanged(); private: SchemePlanManager::SchemeProcessInfo m_process; QLabel *m_label = nullptr; QComboBox *m_algCombo = nullptr; QComboBox *m_dataCombo = nullptr; QSpinBox *m_spinBox = nullptr; QCheckBox *m_checkBox = nullptr; QVBoxLayout *m_layout = nullptr; bool m_isLoaded = false; bool m_allowEdit = true; }; #endif // FLOWGRAPHNODEWIDGET_H