xtoolbutton.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef XTOOLBUTTON_H
  2. #define XTOOLBUTTON_H
  3. #include <QWidget>
  4. #include <QtCore>
  5. #include <QtGui>
  6. class XToolButton : public QWidget
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit XToolButton(QWidget *parent = 0);
  11. ~XToolButton();
  12. void setPixmap(const QPixmap &);
  13. void setText(const QString &);
  14. void setMouseEnterFlag(bool);
  15. void setMousePressFlag(bool);
  16. protected:
  17. void enterEvent(QEvent *);
  18. void leaveEvent(QEvent *);
  19. void mousePressEvent(QMouseEvent *);
  20. void paintEvent(QPaintEvent *);
  21. signals:
  22. void signalLabelPress(XToolButton *);
  23. private:
  24. //functions
  25. void initVariable();
  26. void initSetupUi();
  27. void createFrame();
  28. void createWidget();
  29. void createLayout();
  30. void paintWidget(int, QPainter *);
  31. bool getMouseEnterFlag();
  32. bool getMousePressFlag();
  33. //members
  34. bool m_mouseEnterFlag;
  35. bool m_mousePressFlag;
  36. //pointer members
  37. QVBoxLayout *m_pLayout;
  38. QLabel *m_pLabelIcon;
  39. QLabel *m_pLabelText;
  40. };
  41. #endif // XTOOLBUTTON_H