EvaluateView.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #include "EvaluateView.h"
  2. #include "ProjectListWidget.h"
  3. #include "RenameWidget.h"
  4. #include "EvaluateOptionWidget.h"
  5. #include "common/QFDIcon.h"
  6. #include "SchemeWidget.h"
  7. #include <Widgets/Button.h>
  8. #include <Widgets/LineEdit.h>
  9. #include <QBoxLayout>
  10. #include <QLabel>
  11. #include <QTableWidget>
  12. #include <QDebug>
  13. EvaluateView::EvaluateView(QWidget *parent) : QWidget(parent) { }
  14. void EvaluateView::showEvent(QShowEvent *event)
  15. {
  16. qDebug() << __FUNCTION__ << __LINE__;
  17. if (m_initilized == false) {
  18. initialize();
  19. initLayout();
  20. connectSigalsAndSlots();
  21. m_initilized = true;
  22. }
  23. QWidget::showEvent(event);
  24. }
  25. void EvaluateView::hideEvent(QHideEvent *event)
  26. {
  27. QWidget::hideEvent(event);
  28. }
  29. void EvaluateView::initialize()
  30. {
  31. m_hBoxLayout = new QHBoxLayout(this);
  32. m_listWidget = new QWidget(this);
  33. m_listWidget->setFixedWidth(260);
  34. QPalette pal(m_listWidget->palette());
  35. pal.setColor(QPalette::Background, QColor("#f3f3f3"));
  36. m_listWidget->setAutoFillBackground(true);
  37. m_listWidget->setPalette(pal);
  38. m_listLayout = new QVBoxLayout(m_listWidget);
  39. m_searchLineEdit = new LineEdit(this);
  40. m_searchLineEdit->setIsClearButtonEnabled(true);
  41. m_searchLineEdit->setPlaceholderText("搜索工程");
  42. m_projListWidget = new ProjectListWidget(this);
  43. m_projDetailWidget = new QWidget(this);
  44. m_dataLayout = new QVBoxLayout(m_projDetailWidget);
  45. m_projNameLabel = new QLabel(this);
  46. m_projNameLabel->setObjectName("projNameLabel");
  47. m_projNameLabel->setText("工程1-技术方案评估");
  48. m_strategyLayout = new QHBoxLayout();
  49. m_strategyLayout->setAlignment(Qt::AlignLeft);
  50. m_resultButton = new RadioButton("结果集结群策", this);
  51. m_resultButton->setChecked(true);
  52. m_matrixButton = new RadioButton("矩阵集结群策", this);
  53. m_schemeButton = new PushButton("评估方案", NEWFLICON(QFDIcon, Schecme), this);
  54. m_tabWidget = new QTabWidget(this);
  55. m_tabWidget->setTabPosition(QTabWidget::South);
  56. m_tabWidget->addTab(new QTableWidget(this), "覆盖能力");
  57. m_tabWidget->addTab(new QTableWidget(this), "传输能力");
  58. m_tabWidget->addTab(new QTableWidget(this), "组网能力");
  59. m_pageLayout = new QHBoxLayout();
  60. m_pageLayout->setAlignment(Qt::AlignHCenter);
  61. m_pageLabel = new QLabel("第1/2页", this);
  62. m_lastPageButton = new PushButton("上一级指标", this);
  63. m_nextPageButton = new PushButton("下一级指标", this);
  64. m_separator = new QWidget();
  65. m_separator->setFixedWidth(1);
  66. m_separator->setStyleSheet("background-color:#dddddd");
  67. m_optionWidget = new EvaluateOptionWidget(this);
  68. m_optionWidget->setFixedWidth(200);
  69. m_schemeWidget = new SchemeWidget(this);
  70. }
  71. void EvaluateView::initLayout()
  72. {
  73. m_hBoxLayout->setMargin(0);
  74. m_hBoxLayout->addWidget(m_listWidget);
  75. m_listLayout->addWidget(m_searchLineEdit);
  76. m_listLayout->addWidget(m_projListWidget);
  77. m_hBoxLayout->addWidget(m_projDetailWidget);
  78. m_dataLayout->addWidget(m_projNameLabel);
  79. m_dataLayout->addSpacing(20);
  80. m_dataLayout->addLayout(m_strategyLayout);
  81. m_strategyLayout->addWidget(m_resultButton);
  82. m_strategyLayout->addSpacing(20);
  83. m_strategyLayout->addWidget(m_matrixButton);
  84. m_strategyLayout->addStretch();
  85. m_strategyLayout->addWidget(m_schemeButton);
  86. m_dataLayout->addWidget(m_tabWidget);
  87. m_dataLayout->addLayout(m_pageLayout);
  88. m_pageLayout->addWidget(m_lastPageButton);
  89. m_pageLayout->addWidget(m_pageLabel);
  90. m_pageLayout->addWidget(m_nextPageButton);
  91. m_hBoxLayout->addWidget(m_separator, Qt::AlignRight);
  92. m_hBoxLayout->addWidget(m_optionWidget, Qt::AlignRight);
  93. setStyleSheet("#projNameLabel {font-size:20px;font:bold;color:#333333}"
  94. "QTableWidget {border: 1px solid rgba(0, 0, 0, 0.073);background: rgb(244, 244, "
  95. "255);alternate-background-color: rgb(255, 255, 255);}"
  96. "QHeaderView::section {"
  97. "background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
  98. "stop:0 #616161, stop: 0.5 #505050,"
  99. "stop: 0.6 #434343, stop:1 #656565);"
  100. "color: white;"
  101. "padding-left: 4px;"
  102. "border: 1px solid #6c6c6c;"
  103. "}");
  104. const QString &s = m_schemeButton->styleSheet() + "PushButton {background-color:#92cde1; }";
  105. m_schemeButton->setStyleSheet(s);
  106. }
  107. void EvaluateView::connectSigalsAndSlots()
  108. {
  109. connect(m_schemeButton, &PushButton::clicked, this, &EvaluateView::slotSchemeClicked);
  110. }
  111. void EvaluateView::slotSchemeClicked()
  112. {
  113. if (m_schemeWidget->isVisible() == false) {
  114. m_schemeWidget->show();
  115. }
  116. }