Browse Source

修改创建项目视图。

Ulricy 1 year ago
parent
commit
a3744f261a
2 changed files with 26 additions and 23 deletions
  1. 24 21
      QFD/widgets/CreateProjWidget.cpp
  2. 2 2
      QFD/widgets/CreateProjWidget.h

+ 24 - 21
QFD/widgets/CreateProjWidget.cpp

@@ -54,11 +54,11 @@ void CreateProjWidget::setMode(CreateProjWidget::Mode mode)
 
     m_task->setEnabled(cu);
     m_time->setEnabled(c);
-    m_purpose->setEnabled(cu);
+    m_purpose->setReadOnly(!cu);
     m_unit->setEnabled(cu);
     m_crew->setEnabled(cu);
     m_rank->setEnabled(cu);
-    m_note->setEnabled(cu);
+    m_note->setReadOnly(!cu);
     m_proj->setEnabled(cu);
     m_type1->setEnabled(c);
     m_type2->setEnabled(c);
@@ -95,7 +95,7 @@ ProjectInfo CreateProjWidget::editedProjInfo() const
     ProjectInfo proj;
     proj.taskName          = m_task->text();
     proj.estimateTime      = QString::number(m_time->dateTime().toTime_t());
-    proj.estimateObjective = m_purpose->text();
+    proj.estimateObjective = m_purpose->toPlainText();
     proj.estimateDept      = m_unit->text();
     proj.estimatePerson    = m_crew->text();
     proj.positionalTitles  = m_rank->text();
@@ -124,7 +124,7 @@ void CreateProjWidget::setProjectInfo(ProjectInfo *info)
     m_unit->setText(info->estimateDept);
     m_crew->setText(info->estimatePerson);
     m_rank->setText(info->positionalTitles);
-    m_note->setPlainText(info->remark);
+    m_note->setText(info->remark);
     m_proj->setText(info->projectName);
 
     ProjectManager::EvalTypes types = ProjectManager::evalTypes(*info);
@@ -143,7 +143,7 @@ void CreateProjWidget::initWindow()
     setModal(true);
     setWindowFlags(Qt::Dialog);
     setWindowFlag(Qt::WindowContextHelpButtonHint, false);
-    setFixedSize(360, 600);
+    setFixedSize(460, 700);
 }
 
 void CreateProjWidget::initWidgets()
@@ -153,7 +153,7 @@ void CreateProjWidget::initWidgets()
     m_task = new LineEdit(this);
     m_task->setPlaceholderText("任务名称");
     m_time    = new DateTimeEdit(this);
-    m_purpose = new LineEdit(this);
+    m_purpose = new TextEdit(this);
     m_purpose->setPlaceholderText("评估目的");
     m_unit = new LineEdit(this);
     m_unit->setPlaceholderText("评估单位");
@@ -164,6 +164,8 @@ void CreateProjWidget::initWidgets()
     m_note = new TextEdit(this);
     m_note->setPlaceholderText("备注");
 
+    m_note->setFontPointSize(10);
+
     m_taskLabel = new QLabel(this);
     m_taskLabel->setText("任务名称:");
     m_timeLabel = new QLabel(this);
@@ -200,7 +202,7 @@ void CreateProjWidget::initWidgets()
 
 void CreateProjWidget::initLayout()
 {
-    int minEditWidth = 220;
+    int minEditWidth = 300;
 
     // 总体布局
     m_layout = new QVBoxLayout(this);
@@ -222,35 +224,36 @@ void CreateProjWidget::initLayout()
     m_crew->setFixedWidth(minEditWidth);
     m_rank->setFixedWidth(minEditWidth);
     m_note->setFixedWidth(minEditWidth);
+    m_purposeLabel->setContentsMargins(0, 10, 0, 10);
     m_noteLabel->setContentsMargins(0, 10, 0, 10);
 
     m_summaryLayout->setMargin(10);
     m_summaryLayout->addWidget(m_taskLabel, 1, 0, 1, 1, Qt::AlignRight);
     m_summaryLayout->addWidget(m_timeLabel, 2, 0, 1, 1, Qt::AlignRight);
-    m_summaryLayout->addWidget(m_purposeLabel, 3, 0, 1, 1, Qt::AlignRight);
-    m_summaryLayout->addWidget(m_unitLabel, 4, 0, 1, 1, Qt::AlignRight);
-    m_summaryLayout->addWidget(m_crewLabel, 5, 0, 1, 1, Qt::AlignRight);
-    m_summaryLayout->addWidget(m_rankLabel, 6, 0, 1, 1, Qt::AlignRight);
+    m_summaryLayout->addWidget(m_unitLabel, 3, 0, 1, 1, Qt::AlignRight);
+    m_summaryLayout->addWidget(m_crewLabel, 4, 0, 1, 1, Qt::AlignRight);
+    m_summaryLayout->addWidget(m_rankLabel, 5, 0, 1, 1, Qt::AlignRight);
+    m_summaryLayout->addWidget(m_purposeLabel, 6, 0, 1, 1, Qt::AlignRight | Qt::AlignTop);
     m_summaryLayout->addWidget(m_noteLabel, 7, 0, 1, 1, Qt::AlignRight | Qt::AlignTop);
 
     m_summaryLayout->addWidget(m_task, 1, 1, 1, 1, Qt::AlignLeft);
     m_summaryLayout->addWidget(m_time, 2, 1, 1, 1, Qt::AlignLeft);
-    m_summaryLayout->addWidget(m_purpose, 3, 1, 1, 1, Qt::AlignLeft);
-    m_summaryLayout->addWidget(m_unit, 4, 1, 1, 1, Qt::AlignLeft);
-    m_summaryLayout->addWidget(m_crew, 5, 1, 1, 1, Qt::AlignLeft);
-    m_summaryLayout->addWidget(m_rank, 6, 1, 1, 1, Qt::AlignLeft);
+    m_summaryLayout->addWidget(m_unit, 3, 1, 1, 1, Qt::AlignLeft);
+    m_summaryLayout->addWidget(m_crew, 4, 1, 1, 1, Qt::AlignLeft);
+    m_summaryLayout->addWidget(m_rank, 5, 1, 1, 1, Qt::AlignLeft);
+    m_summaryLayout->addWidget(m_purpose, 6, 1, 1, 1, Qt::AlignLeft);
     m_summaryLayout->addWidget(m_note, 7, 1, 1, 1, Qt::AlignLeft);
 
     // 项目信息布局
     m_projLayout->setMargin(10);
     m_proj->setFixedWidth(minEditWidth);
     m_projLayout->addWidget(m_projLabel, 0, 0, 1, 1, Qt::AlignLeft);
-    m_projLayout->addWidget(m_proj, 0, 1, 1, 5, Qt::AlignLeft);
-    m_projLayout->addWidget(new QWidget(this), 1, 1, 4, 1, Qt::AlignLeft);
+    m_projLayout->addWidget(m_proj, 0, 1, 1, 1, Qt::AlignLeft);
+    m_projLayout->addWidget(new QWidget(this), 1, 1, 1, 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_projLayout->addWidget(m_type1, 4, 1, 1, 1, Qt::AlignLeft);
+    m_projLayout->addWidget(m_type2, 5, 1, 1, 1, Qt::AlignLeft);
+    m_projLayout->addWidget(m_type3, 6, 1, 1, 1, Qt::AlignLeft);
 
     // 按钮布局
     m_btnLayout->addStretch();
@@ -262,7 +265,7 @@ void CreateProjWidget::initLayout()
 void CreateProjWidget::connectSignalsAndSlots()
 {
     connect(m_task, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
-    connect(m_purpose, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
+    connect(m_purpose, &TextEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
     connect(m_unit, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
     connect(m_crew, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);
     connect(m_rank, &LineEdit::textChanged, this, &CreateProjWidget::slotTextChanged);

+ 2 - 2
QFD/widgets/CreateProjWidget.h

@@ -65,18 +65,18 @@ private:
     QLabel *m_summary    = nullptr;  // 项目概要
     LineEdit *m_task     = nullptr;  // 任务名称
     DateTimeEdit *m_time = nullptr;  // 评估时间
-    LineEdit *m_purpose  = nullptr;  // 评估目的
     LineEdit *m_unit     = nullptr;  // 评估单位
     LineEdit *m_crew     = nullptr;  // 评估人员
     LineEdit *m_rank     = nullptr;  // 职称
+    TextEdit *m_purpose  = nullptr;  // 评估目的
     TextEdit *m_note     = nullptr;  // 备注
 
     QLabel *m_taskLabel    = nullptr;
     QLabel *m_timeLabel    = nullptr;
-    QLabel *m_purposeLabel = nullptr;
     QLabel *m_unitLabel    = nullptr;
     QLabel *m_crewLabel    = nullptr;
     QLabel *m_rankLabel    = nullptr;
+    QLabel *m_purposeLabel = nullptr;
     QLabel *m_noteLabel    = nullptr;
 
     QWidget *m_separator = nullptr;  // 分隔线