xstatusbar.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "xstatusbar.h"
  2. XStatusBar::XStatusBar(QWidget *parent) :
  3. QWidget(parent)
  4. {
  5. createWidget();
  6. createLayout();
  7. }
  8. XStatusBar::~XStatusBar()
  9. {
  10. delete m_pLabelAppVersion;
  11. delete m_pLabelSegVersion;
  12. delete m_pLabelNetState;
  13. delete m_pBtnUpdate;
  14. delete m_pLabel;
  15. delete m_pLayout;
  16. }
  17. void XStatusBar::createWidget()
  18. {
  19. m_pLabelAppVersion = new QLabel("主程序版本",this);
  20. m_pLabelSegVersion = new QLabel("号段版本",this);
  21. m_pLabelNetState = new QLabel("网络状态",this);
  22. m_pBtnUpdate = new XTextButton("检查更新",this);
  23. m_pLabel = new XLabel(this);
  24. m_pLabel->setText("test");
  25. m_pLabel->setPixmap(QPixmap(":/images/toolbar/toolbar1.png"));
  26. }
  27. void XStatusBar::createLayout()
  28. {
  29. m_pLayout = new QHBoxLayout(this);
  30. m_pLayout->addWidget(m_pLabelAppVersion);
  31. m_pLayout->addWidget(m_pLabelSegVersion);
  32. m_pLayout->addWidget(m_pBtnUpdate);
  33. m_pLayout->addStretch(1);
  34. m_pLayout->addWidget(m_pLabelNetState);
  35. m_pLayout->addStretch(2);
  36. m_pLayout->addWidget(m_pLabel);
  37. setLayout(m_pLayout);
  38. setMouseTracking(true);
  39. }