12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include "AddSchemeWidget.h"
- #include <Widgets/Button.h>
- #include <Widgets/LineEdit.h>
- #include <QBoxLayout>
- #include <QLabel>
- AddSchemeWidget::AddSchemeWidget(QWidget *parent) : QDialog(parent)
- {
- initWindow();
- initialize();
- initLayout();
- connectSignalsAndSlots();
- }
- void AddSchemeWidget::clearInputs()
- {
- m_nameEdit->clear();
- m_schemeEdit->clear();
- }
- void AddSchemeWidget::initWindow()
- {
- setWindowTitle("新建方案");
- setModal(true);
- setWindowFlags(Qt::Dialog);
- setWindowFlag(Qt::WindowContextHelpButtonHint, false);
- resize(350, 250);
- }
- void AddSchemeWidget::initialize()
- {
- m_vBoxLayout = new QVBoxLayout(this);
- m_gridLayout = new QGridLayout();
- m_nameLabel = new QLabel("方案名称:", this);
- m_nameLabel->setFixedHeight(44);
- m_nameEdit = new LineEdit(this);
- m_nameEdit->setFixedWidth(250);
- m_schemeLabel = new QLabel("方案描述:", this);
- m_schemeLabel->setFixedHeight(35);
- m_schemeEdit = new TextEdit(this);
- m_schemeEdit->setFixedWidth(250);
- m_schemeEdit->setFixedHeight(150);
- m_hBoxLayout = new QHBoxLayout();
- m_confirButton = new PushButton("生成", this);
- }
- void AddSchemeWidget::initLayout()
- {
- m_vBoxLayout->setMargin(15);
- m_vBoxLayout->addLayout(m_gridLayout);
- m_gridLayout->addWidget(m_nameLabel, 0, 0, 1, 1, Qt::AlignRight);
- m_gridLayout->addWidget(m_nameEdit, 0, 1, 1, 2, Qt::AlignLeft);
- m_gridLayout->addWidget(m_schemeLabel, 1, 0, 1, 1, Qt::AlignRight | Qt::AlignTop);
- m_gridLayout->addWidget(m_schemeEdit, 1, 1, 1, 2, Qt::AlignLeft);
- m_vBoxLayout->addSpacing(20);
- m_vBoxLayout->addStretch();
- m_vBoxLayout->addLayout(m_hBoxLayout);
- m_hBoxLayout->addStretch();
- m_hBoxLayout->addWidget(m_confirButton);
- }
- void AddSchemeWidget::connectSignalsAndSlots() { }
|