123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #include "FlowGraphNodeWidget.h"
- #include <QBoxLayout>
- #include <QLabel>
- #include <QCheckBox>
- #include <QComboBox>
- #include <QSpinBox>
- FlowGraphNodeWidget::FlowGraphNodeWidget(NodeWidgetType type, QWidget *parent) : QWidget(parent), m_type(type)
- {
- setFixedSize(QSize(130, 40));
- }
- FlowGraphNodeWidget::NodeWidgetType FlowGraphNodeWidget::type() const
- {
- return m_type;
- }
- FlowGraphPlainNodeWidget::FlowGraphPlainNodeWidget(QWidget *parent) : FlowGraphNodeWidget(Plain, parent)
- {
- m_label = new QLabel(this);
- m_label->setText("test");
- m_label->setAlignment(Qt::AlignCenter);
- QBoxLayout *l = new QVBoxLayout(this);
- l->addWidget(m_label);
- }
- void FlowGraphPlainNodeWidget::setText(const QString text)
- {
- m_label->setText(text);
- }
- FlowGraphCheckNodeWidget::FlowGraphCheckNodeWidget(QWidget *parent) : FlowGraphNodeWidget(CheckBox, parent)
- {
- m_checkBox = new QCheckBox("执行", this);
- QBoxLayout *l = new QVBoxLayout(this);
- l->setAlignment(Qt::AlignCenter);
- l->addWidget(m_checkBox);
- }
- FlowGraphComboNodeWidget::FlowGraphComboNodeWidget(QWidget *parent) : FlowGraphNodeWidget(ComboBox, parent)
- {
- m_combo = new QComboBox(this);
- QBoxLayout *l = new QVBoxLayout(this);
- l->addWidget(m_combo);
- }
- QList<QString> FlowGraphComboNodeWidget::items() const
- {
- return m_items;
- }
- void FlowGraphComboNodeWidget::setItems(QList<QString> items)
- {
- m_items = items;
- m_combo->clear();
- m_combo->addItems(items);
- }
- FlowGraphSpinNodeWidget::FlowGraphSpinNodeWidget(QWidget *parent) : FlowGraphNodeWidget(SpinBox, parent)
- {
- m_spinBox = new QSpinBox(this);
- m_spinBox->setMinimum(1);
- m_spinBox->setMaximum(10);
- m_spinBox->setValue(3);
- QBoxLayout *l = new QVBoxLayout(this);
- l->addWidget(m_spinBox);
- }
|