| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | #ifndef STARWIDGET_H
 | 
					
						
							|  |  |  | #define STARWIDGET_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-27 12:27:27 -03:00
										 |  |  | enum StarConfig {SPACING = 2, IMG_SIZE = 16, TOTALSTARS = 5}; | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | class StarWidget : public QWidget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	explicit StarWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); | 
					
						
							|  |  |  | 	int currentStars() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/*reimp*/ QSize sizeHint() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-27 12:27:27 -03:00
										 |  |  | 	static QPixmap starActive(); | 
					
						
							|  |  |  | 	static QPixmap starInactive(); | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-19 10:20:16 -07:00
										 |  |  | signals: | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 	void valueChanged(int stars); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-19 10:20:16 -07:00
										 |  |  | public slots: | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 	void setCurrentStars(int value); | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	void setReadOnly( bool readOnly); | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	/*reimp*/ void mouseReleaseEvent(QMouseEvent* ); | 
					
						
							|  |  |  | 	/*reimp*/ void paintEvent(QPaintEvent* ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	int current; | 
					
						
							| 
									
										
										
										
											2013-11-30 09:18:01 -08:00
										 |  |  | 	bool readOnly; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-27 12:27:27 -03:00
										 |  |  | 	static QPixmap* activeStar; | 
					
						
							|  |  |  | 	static QPixmap* inactiveStar; | 
					
						
							| 
									
										
										
										
											2013-04-22 16:00:27 -07:00
										 |  |  | 	QPixmap grayImage(QPixmap *coloredImg); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // STARWIDGET_H
 |