ConfigMeasureDataWidget.cpp 2.6 KB

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