• Main Page
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/Users/David/Documents/QtProjects/visualsc/scgraphicsview/buttongraphic.h

Go to the documentation of this file.
00001 #ifndef BUTTONGRAPHIC_H
00002 #define BUTTONGRAPHIC_H
00003 
00004 #include <QGraphicsObject>
00005 class QPixmap;
00006 
00014 class ButtonGraphic : public QGraphicsObject
00015 {
00016     Q_OBJECT
00017 
00018 public:
00019     ButtonGraphic(int x, int y);
00020     ~ButtonGraphic();
00021 
00022     enum MouseState { kNormal, kHovered, kPressed};
00023 
00024     void setNormalGraphic(QString source);
00025     void setHoveredGraphic(QString source);
00026     void setDepressedGraphic(QString source);
00027 
00028     virtual QRectF boundingRect() const;
00029 
00030 signals:
00031     void clicked();
00032 
00033 
00034 protected:
00035     virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00036     virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
00037     virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event )  ;
00038     virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
00039     virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
00040 
00041 
00042 private:
00043     QPixmap *_normalGraphic;
00044     QPixmap *_hoveredGraphic;
00045     QPixmap *_depressedGraphic;
00046     MouseState _mouseState;
00047 
00048 };
00049 
00050 #endif // BUTTONGRAPHIC_H

Generated on Mon Sep 26 2011 06:59:25 for visualsc by  doxygen 1.7.1