SchemePlanWidget.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "SchemePlanWidget.h"
  2. #include "SchemeFlowWidget.h"
  3. #include <CSchemeView.h>
  4. #include <Widgets/Button.h>
  5. #include <QTabWidget>
  6. #include <QLayout>
  7. #include <QDebug>
  8. SchemePlanWidget::SchemePlanWidget(ProjectInfo *proj, QWidget *parent) : EvalWidget(proj, parent)
  9. {
  10. setTitle("评估方案规划");
  11. setupUI();
  12. }
  13. void SchemePlanWidget::setType(int type)
  14. {
  15. EvalWidget::setType(type);
  16. setupTabWidget();
  17. }
  18. void SchemePlanWidget::setupUI()
  19. {
  20. m_topLayout->addStretch();
  21. m_export = new PushButton("保存", this);
  22. m_export->setEnabled(false);
  23. m_topLayout->addWidget(m_export);
  24. m_topLayout->addSpacing(10);
  25. connect(m_export, &PushButton::clicked, this, &SchemePlanWidget::slotExportClicked);
  26. }
  27. void SchemePlanWidget::setupTabWidget()
  28. {
  29. m_tab->clear();
  30. for (int i : indexList()) {
  31. SchemeFlowWidget *m = new SchemeFlowWidget(proj(), this);
  32. connect(m, &SchemeFlowWidget::sigSchemeProcessCreated, this, &SchemePlanWidget::slotSchemeCreated);
  33. connect(m, &SchemeFlowWidget::sigSchemeProcessEdited, this, &SchemePlanWidget::slotSchemeProcessEdited);
  34. m->setType(i);
  35. ProjectManager::IndexType t = (ProjectManager::IndexType)i;
  36. QString s = ProjectManager::nameOfIndexType(t);
  37. m_tab->addTab(m, s);
  38. }
  39. }
  40. void SchemePlanWidget::slotExportClicked()
  41. {
  42. for (int i = 0; i < m_tab->count(); i++) {
  43. SchemeFlowWidget *w = (SchemeFlowWidget *)m_tab->widget(i);
  44. QList<SchemePlanManager::SchemeProcessInfo> schemes = w->schemes();
  45. }
  46. }
  47. void SchemePlanWidget::slotSchemeCreated()
  48. {
  49. SchemeFlowWidget *w = (SchemeFlowWidget *)sender();
  50. qDebug() << __FUNCTION__ << __LINE__ << w->indexType() << endl;
  51. }
  52. void SchemePlanWidget::slotSchemeProcessEdited(const SchemePlanManager::SchemeProcessInfo &process)
  53. {
  54. qDebug() << __FUNCTION__ << __LINE__ << process.id << endl;
  55. }