123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- #ifndef FLOWGRAPHNODEWIDGET_H
- #define FLOWGRAPHNODEWIDGET_H
- #include <QWidget>
- 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<QString> items() const;
- void setItems(QList<QString> items);
- private:
- QComboBox *m_combo = nullptr;
- QList<QString> m_items;
- };
- class FlowGraphSpinNodeWidget : public FlowGraphNodeWidget
- {
- Q_OBJECT
- public:
- explicit FlowGraphSpinNodeWidget(QWidget *parent = nullptr);
- private:
- QSpinBox *m_spinBox = nullptr;
- };
- #include <SchemePlanManager.h>
- 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<SchemePlanManager::Algorithm> optionalAlgs() const;
- QList<SchemePlanManager::SchemeDataSource> 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
|