widget.cpp 747 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "widget.h"
  2. #include "ui_widget.h"
  3. #include "LHQLogAPI.h"
  4. Widget::Widget(QWidget *parent) :
  5. QWidget(parent),
  6. ui(new Ui::Widget)
  7. {
  8. ui->setupUi(this);
  9. m_tSwitch = new TransmitterSwitch(this);
  10. /* 设置一个布局 */
  11. m_layout = new QVBoxLayout(this);
  12. m_layout->addWidget(m_tSwitch);
  13. setLayout(m_layout);
  14. /* 设置边距为0 */
  15. m_layout->setMargin(20);
  16. m_layout->setSpacing(0);
  17. /* 设置参数 */
  18. m_tSwitch->setQSS(":/QSS/QSS/TransmitterSwitch_dark.qss");
  19. }
  20. Widget::~Widget()
  21. {
  22. if(m_tSwitch != nullptr)
  23. {
  24. delete m_tSwitch;
  25. m_tSwitch = nullptr;
  26. }
  27. if(m_layout != nullptr)
  28. {
  29. delete m_layout;
  30. m_layout = nullptr;
  31. }
  32. delete ui;
  33. }