HWndUnit.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef HWNDUNIT_H
  2. #define HWNDUNIT_H
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QComboBox>
  6. #include <QTimer>
  7. #include "QHalconWindow.h"
  8. #include "showunit_global.h"
  9. #include "Util.h"
  10. #include "MyStream.h"
  11. //#pragma execution_character_set("utf-8")
  12. class SHOWUNITSHARED_EXPORT HWndUnit: public QWidget
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit HWndUnit(QWidget *parent = nullptr);
  17. QHalconWindow *getHWndCtrl(void){ return m_pImageWindow; }
  18. void setWndTitle(const QString &title);
  19. void ShowImage(HImage image);
  20. //void ShowObj(HObject obj, QString strColor, int nLinsWhite = 1, bool bFillRawing = false);
  21. void ShowObj(HObject obj, QColor color = qRgb(255, 0, 0), int nLinsWhite = 1);
  22. void ShowObj(HObject obj, bool bFillRawing = false, int nLinsWhite = 1, int nModes = 0);
  23. void ShowMsg(HTuple msg, QColor color = qRgb(0, 255, 0), int nX = 10, int nY = 10, int nSize = 5);
  24. /// <summary>
  25. /// 根据参数,决定是否实时刷新
  26. /// </summary>
  27. /// <param name="isRealTime"></param>
  28. void Refresh(bool isRealTime = false);
  29. public slots:
  30. void on_MousePosMessage(const QString &message);
  31. void onTimer();
  32. protected:
  33. void resizeEvent(QResizeEvent* ) override;
  34. void RefreshWindow();
  35. private:
  36. QLabel * m_plabelStatus;
  37. QLabel * m_plabelTitle;
  38. QHalconWindow * m_pImageWindow;
  39. QWidget* m_paren;
  40. QTimer* m_pTimer;
  41. bool m_bUpdate;
  42. };
  43. #endif // HWNDUNIT_H