|
@@ -5,6 +5,7 @@
|
|
|
#include <Widgets/LineEdit.h>
|
|
|
#include <Widgets/Button.h>
|
|
|
#include <Widgets/CheckBox.h>
|
|
|
+#include <Widgets/SpinBox.h>
|
|
|
|
|
|
#include <QGridLayout>
|
|
|
#include <QLabel>
|
|
@@ -14,31 +15,22 @@
|
|
|
CreateProjWidget::CreateProjWidget(QWidget *parent) : QDialog(parent)
|
|
|
{
|
|
|
initWindow();
|
|
|
- initialize();
|
|
|
+ initWidgets();
|
|
|
initLayout();
|
|
|
connectSignalsAndSlots();
|
|
|
}
|
|
|
|
|
|
const QString CreateProjWidget::projName() const
|
|
|
{
|
|
|
- return m_nameLineEdit->text();
|
|
|
-}
|
|
|
-
|
|
|
-bool CreateProjWidget::importanceSelected() const
|
|
|
-{
|
|
|
- return m_importanceEvalCheckBox->isChecked();
|
|
|
-}
|
|
|
-
|
|
|
-bool CreateProjWidget::schemeSelected() const
|
|
|
-{
|
|
|
- return m_schemeEvalCheckBox->isChecked();
|
|
|
+ return m_name->text();
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::clearInputs()
|
|
|
{
|
|
|
- m_nameLineEdit->clear();
|
|
|
- m_importanceEvalCheckBox->setChecked(false);
|
|
|
- m_schemeEvalCheckBox->setChecked(false);
|
|
|
+ m_name->clear();
|
|
|
+ m_type1->setChecked(false);
|
|
|
+ m_type2->setChecked(false);
|
|
|
+ m_type3->setChecked(false);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::initWindow()
|
|
@@ -50,89 +42,103 @@ void CreateProjWidget::initWindow()
|
|
|
setModal(true);
|
|
|
setWindowFlags(Qt::Dialog);
|
|
|
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
|
|
- resize(500, 300);
|
|
|
+ resize(400, 600);
|
|
|
}
|
|
|
|
|
|
-void CreateProjWidget::initialize()
|
|
|
+void CreateProjWidget::initWidgets()
|
|
|
{
|
|
|
- m_vBoxLayout = new QVBoxLayout(this);
|
|
|
- m_gridLayout = new QGridLayout();
|
|
|
- m_nameLabel = new QLabel(this);
|
|
|
- m_nameLabel->setText("工程名:");
|
|
|
+ m_summary = new QLabel(this);
|
|
|
+ m_summary->setText("项目概要:");
|
|
|
+ m_taskName = new LineEdit(this);
|
|
|
+ m_taskName->setPlaceholderText("任务名称");
|
|
|
+ m_evalTime = new DateTimeEdit(this);
|
|
|
+ m_evalTime->setDateTime(QDateTime::currentDateTime());
|
|
|
+ m_evalPurpose = new LineEdit(this);
|
|
|
+ m_evalPurpose->setPlaceholderText("评估目的");
|
|
|
+ m_evalUnit = new LineEdit(this);
|
|
|
+ m_evalUnit->setPlaceholderText("评估单位");
|
|
|
+ m_evalCrew = new LineEdit(this);
|
|
|
+ m_evalCrew->setPlaceholderText("评估人员");
|
|
|
+ m_rank = new LineEdit(this);
|
|
|
+ m_rank->setPlaceholderText("职称");
|
|
|
+ m_note = new TextEdit(this);
|
|
|
+ m_note->setPlaceholderText("备注");
|
|
|
+
|
|
|
+ m_separator = new QWidget(this);
|
|
|
+ m_separator->setFixedHeight(1);
|
|
|
+ m_separator->setStyleSheet("background-color:#dddddd");
|
|
|
+
|
|
|
+ m_nameLabel = new QLabel(this);
|
|
|
+ m_nameLabel->setText("项目名称:");
|
|
|
+ m_name = new LineEdit(this);
|
|
|
+ m_name->setPlaceholderText("请输入项目名称");
|
|
|
m_typeLabel = new QLabel(this);
|
|
|
- m_typeLabel->setText("类型(多选):");
|
|
|
- m_nameLineEdit = new LineEdit(this);
|
|
|
- m_nameLineEdit->setPlaceholderText("请输入工程名");
|
|
|
- m_nameLineEdit->setMaximumWidth(500);
|
|
|
- m_nameLineEdit->setMinimumWidth(300);
|
|
|
- m_importanceEvalCheckBox = new CheckBox(EngineerInfo::nameOFEvalType(EngineerInfo::Importance), this);
|
|
|
- m_capaIndexCheckBox = new CheckBox(EngineerInfo::nameOFIndexType(EngineerInfo::Capability), this);
|
|
|
- m_capaIndexCheckBox->setEnabled(false);
|
|
|
- m_techIndexCheckBox = new CheckBox(EngineerInfo::nameOFIndexType(EngineerInfo::TechMessaures), this);
|
|
|
- m_techIndexCheckBox->setEnabled(false);
|
|
|
- m_schemeEvalCheckBox = new CheckBox(EngineerInfo::nameOFEvalType(EngineerInfo::TechSchema), this);
|
|
|
- m_schemeIndexCheckBox = new CheckBox(EngineerInfo::nameOFIndexType(EngineerInfo::SchemaEval), this);
|
|
|
- m_schemeIndexCheckBox->setEnabled(false);
|
|
|
-
|
|
|
- m_buttonLayout = new QHBoxLayout();
|
|
|
- m_createButton = new PushButton("创建", this);
|
|
|
- m_createButton->setEnabled(false);
|
|
|
- m_cancelButton = new PushButton("取消", this);
|
|
|
+ m_typeLabel->setText("评估类型:");
|
|
|
+ m_type1 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::Requirements), this);
|
|
|
+ m_type2 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::SchemeOptimization), this);
|
|
|
+ m_type3 = new CheckBox(EngineerInfo::nameOfEvalType(EngineerInfo::OverallEfficiency), this);
|
|
|
+
|
|
|
+ m_confirm = new PushButton("创建", this);
|
|
|
+ m_cancel = new PushButton("取消", this);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::initLayout()
|
|
|
{
|
|
|
- m_vBoxLayout->setContentsMargins(50, 20, 50, 20);
|
|
|
-
|
|
|
- m_vBoxLayout->addLayout(m_gridLayout);
|
|
|
- m_gridLayout->addWidget(m_nameLabel, 0, 0, 1, 1, Qt::AlignRight);
|
|
|
- m_gridLayout->addWidget(m_nameLineEdit, 0, 1, 1, 5, Qt::AlignLeft);
|
|
|
-
|
|
|
- m_gridLayout->addWidget(new QWidget(this), 1, 1, 4, 1, Qt::AlignLeft);
|
|
|
-
|
|
|
- m_gridLayout->addWidget(m_typeLabel, 4, 0, 1, 1, Qt::AlignRight);
|
|
|
- m_gridLayout->addWidget(m_importanceEvalCheckBox, 4, 1, 1, 5, Qt::AlignLeft);
|
|
|
- m_gridLayout->addWidget(m_capaIndexCheckBox, 5, 2, 1, 7, Qt::AlignLeft);
|
|
|
- m_gridLayout->addWidget(m_techIndexCheckBox, 6, 2, 1, 7, Qt::AlignLeft);
|
|
|
- m_gridLayout->addWidget(new QWidget(this), 7, 1, 4, 1, Qt::AlignLeft);
|
|
|
- m_gridLayout->addWidget(m_schemeEvalCheckBox, 8, 1, 1, 5, Qt::AlignLeft);
|
|
|
- m_gridLayout->addWidget(m_schemeIndexCheckBox, 9, 2, 1, 7, Qt::AlignLeft);
|
|
|
-
|
|
|
- m_vBoxLayout->addStretch();
|
|
|
- m_vBoxLayout->addLayout(m_buttonLayout);
|
|
|
- m_buttonLayout->addStretch();
|
|
|
- m_buttonLayout->addWidget(m_createButton);
|
|
|
- m_buttonLayout->addWidget(m_cancelButton);
|
|
|
+ // 总体布局
|
|
|
+ m_layout = new QVBoxLayout(this);
|
|
|
+ m_layout->setContentsMargins(50, 20, 50, 20);
|
|
|
+ m_summaryLayout = new QVBoxLayout();
|
|
|
+ m_layout->addLayout(m_summaryLayout);
|
|
|
+ m_layout->addWidget(m_separator);
|
|
|
+ m_projLayout = new QGridLayout();
|
|
|
+ m_layout->addLayout(m_projLayout);
|
|
|
+ m_btnLayout = new QHBoxLayout();
|
|
|
+ m_layout->addLayout(m_btnLayout);
|
|
|
+
|
|
|
+ // 项目概要布局
|
|
|
+ m_summaryLayout->addWidget(m_summary);
|
|
|
+ m_summaryLayout->addWidget(m_taskName);
|
|
|
+ m_summaryLayout->addWidget(m_evalTime);
|
|
|
+ m_summaryLayout->addWidget(m_evalPurpose);
|
|
|
+ m_summaryLayout->addWidget(m_evalUnit);
|
|
|
+ m_summaryLayout->addWidget(m_evalCrew);
|
|
|
+ m_summaryLayout->addWidget(m_rank);
|
|
|
+ m_summaryLayout->addWidget(m_note);
|
|
|
+
|
|
|
+ // 项目信息布局
|
|
|
+ m_projLayout->addWidget(m_nameLabel, 0, 0, 1, 1, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_name, 0, 1, 1, 5, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(new QWidget(this), 1, 1, 4, 1, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_typeLabel, 4, 0, 1, 1, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_type1, 4, 1, 1, 5, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_type2, 5, 1, 1, 5, Qt::AlignLeft);
|
|
|
+ m_projLayout->addWidget(m_type3, 6, 1, 1, 5, Qt::AlignLeft);
|
|
|
+
|
|
|
+ // 按钮布局
|
|
|
+ m_btnLayout->addStretch();
|
|
|
+ m_btnLayout->addWidget(m_confirm);
|
|
|
+ m_btnLayout->addWidget(m_cancel);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::connectSignalsAndSlots()
|
|
|
{
|
|
|
- connect(m_nameLineEdit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
|
|
|
- connect(m_importanceEvalCheckBox, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
- connect(m_schemeEvalCheckBox, &CheckBox::stateChanged, this, &CreateProjWidget::slotCheckBoxChanged);
|
|
|
- connect(m_createButton, &PushButton::clicked, this, &CreateProjWidget::slotCreateClicked);
|
|
|
- connect(m_cancelButton, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
|
|
|
+ connect(m_name, &LineEdit::textChanged, this, &CreateProjWidget::slotProjNameChanged);
|
|
|
+ connect(m_confirm, &PushButton::clicked, this, &CreateProjWidget::slotCreateClicked);
|
|
|
+ connect(m_cancel, &PushButton::clicked, this, &CreateProjWidget::slotCancelClicked);
|
|
|
}
|
|
|
|
|
|
void CreateProjWidget::updateCreateButtonState()
|
|
|
{
|
|
|
- bool nameValid = m_nameLineEdit->text().length() > 0;
|
|
|
- bool typeValid = m_importanceEvalCheckBox->isChecked() || m_schemeEvalCheckBox->isChecked();
|
|
|
-
|
|
|
- m_createButton->setEnabled(nameValid && typeValid);
|
|
|
-}
|
|
|
+ bool summaryValid;
|
|
|
+ bool nameValid;
|
|
|
+ bool typeValid;
|
|
|
|
|
|
-void CreateProjWidget::slotTextChanged(const QString &text)
|
|
|
-{
|
|
|
- m_nameLineEdit->setText(text.trimmed());
|
|
|
- updateCreateButtonState();
|
|
|
+ m_confirm->setEnabled(summaryValid && nameValid && typeValid);
|
|
|
}
|
|
|
|
|
|
-void CreateProjWidget::slotCheckBoxChanged(int)
|
|
|
+void CreateProjWidget::slotProjNameChanged(const QString &text)
|
|
|
{
|
|
|
- m_capaIndexCheckBox->setChecked(m_importanceEvalCheckBox->isChecked());
|
|
|
- m_techIndexCheckBox->setChecked(m_importanceEvalCheckBox->isChecked());
|
|
|
- m_schemeIndexCheckBox->setChecked(m_schemeEvalCheckBox->isChecked());
|
|
|
+ m_name->setText(text.trimmed());
|
|
|
updateCreateButtonState();
|
|
|
}
|
|
|
|