ConfigMeasureDataWidget.cpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include "ConfigMeasureDataWidget.h"
  2. #include "ProjectManager.h"
  3. #include "dbService/SchemeInfoService.h"
  4. #include <Widgets/Button.h>
  5. #include <Common/Icon.h>
  6. #include <QLabel>
  7. #include <QListWidget>
  8. #include <QBoxLayout>
  9. #include <QDebug>
  10. ConfigMeasureDataWidget::ConfigMeasureDataWidget(QWidget *parent) : QWidget(parent)
  11. {
  12. initWidget();
  13. initLayout();
  14. connectSignalsAndSlots();
  15. }
  16. void ConfigMeasureDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo process)
  17. {
  18. m_process = process;
  19. }
  20. void ConfigMeasureDataWidget::initWidget()
  21. {
  22. m_titleLabel = new QLabel("导入实测数据", this);
  23. m_titleLabel->setObjectName("titleLabel");
  24. m_titleLabel->setFixedHeight(50);
  25. m_titleLabel->setContentsMargins(10, 0, 0, 0);
  26. m_listTitleLabel = new QLabel("数据列表", this);
  27. m_listTitleLabel->setObjectName("listTitleLabel");
  28. m_tipsLabel = new QLabel("已导入的数据将会显示在这里", this);
  29. m_tipsLabel->setObjectName("tipsLabel");
  30. m_tipsLabel->setHidden(true);
  31. m_addButton = new QPushButton(NEWFLICON(FluentIcon, ADD)->icon(), "", this);
  32. m_addButton->setToolTip("添加数据");
  33. m_listWidget = new QListWidget(this);
  34. setStyleSheet("#titleLabel {color:#333333; font-size:16px}"
  35. "#listTitleLabel {color:#333333; font-size:12px}"
  36. "QPushButton {border: 0;background-color: qlineargradient(x1: 0, y1: 0, x2: "
  37. "0, y2: 1,stop: 0 #f8f8f8, stop: 1 #f8f8f8);}"
  38. "QPushButton::hover {border: 1px solid rgba(0, 0, 0, 0.073);}"
  39. "QPushButton::pressed {background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, "
  40. "stop: 1 #f6f7fa);}"
  41. "QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);}"
  42. "QListView::item {height:44;}");
  43. }
  44. void ConfigMeasureDataWidget::initLayout()
  45. {
  46. m_layout = new QVBoxLayout(this);
  47. m_layout->setMargin(0);
  48. m_layout->setSpacing(0);
  49. m_layout->addWidget(m_titleLabel);
  50. m_headerLayout = new QHBoxLayout();
  51. m_layout->addLayout(m_headerLayout);
  52. m_layout->addSpacing(10);
  53. m_layout->addWidget(m_tipsLabel);
  54. m_layout->addWidget(m_listWidget);
  55. m_headerLayout->addWidget(m_listTitleLabel);
  56. m_headerLayout->addStretch();
  57. m_headerLayout->addWidget(m_addButton);
  58. }
  59. void ConfigMeasureDataWidget::connectSignalsAndSlots()
  60. {
  61. connect(m_addButton, &PushButton::clicked, this, &ConfigMeasureDataWidget::slotAddDataClicked);
  62. }
  63. void ConfigMeasureDataWidget::slotAddDataClicked()
  64. {
  65. emit sigAddData();
  66. }