widget.cpp 879 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /* 初始化WebAPI */
  20. m_tSwitch->setWebAPIInfo("http://192.1.3.133:31000/v6/", "2e36b53ccd2a433b9a803b98d683ed91", "TMS");
  21. }
  22. Widget::~Widget()
  23. {
  24. if(m_tSwitch != nullptr)
  25. {
  26. delete m_tSwitch;
  27. m_tSwitch = nullptr;
  28. }
  29. if(m_layout != nullptr)
  30. {
  31. delete m_layout;
  32. m_layout = nullptr;
  33. }
  34. delete ui;
  35. }