Nepomuk
kratingpainter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _NEPOMUK_RATING_PAINTER_H_
00022 #define _NEPOMUK_RATING_PAINTER_H_
00023
00024 #include "nepomuk_export.h"
00025
00026 #include <QtCore/Qt>
00027
00028 class QIcon;
00029 class QPixmap;
00030 class QPainter;
00031 class QPoint;
00032 class QRect;
00033
00034
00048 class NEPOMUK_EXPORT KRatingPainter
00049 {
00050 public:
00056 KRatingPainter();
00057
00061 ~KRatingPainter();
00062
00069 int maxRating() const;
00070
00078 bool halfStepsEnabled() const;
00079
00085 Qt::Alignment alignment() const;
00086
00094 Qt::LayoutDirection layoutDirection() const;
00095
00102 QIcon icon() const;
00103
00110 bool isEnabled() const;
00111
00118 QPixmap customPixmap() const;
00119
00125 int spacing() const;
00126
00130 void setMaxRating( int max );
00131
00136 void setHalfStepsEnabled( bool enabled );
00137
00142 void setAlignment( Qt::Alignment align );
00143
00147 void setLayoutDirection( Qt::LayoutDirection direction );
00148
00152 void setIcon( const QIcon& icon );
00153
00157 void setEnabled( bool enabled );
00158
00162 void setCustomPixmap( const QPixmap& pixmap );
00163
00169 void setSpacing( int spacing );
00170
00183 void paint( QPainter* painter, const QRect& rect, int rating, int hoverRating = -1 ) const;
00184
00191 int ratingFromPosition( const QRect& rect, const QPoint& pos ) const;
00192
00201 static void paintRating( QPainter* p, const QRect& rect, Qt::Alignment align, int rating, int hoverRating = -1 );
00202
00210 static int getRatingFromPosition( const QRect& rect, Qt::Alignment align, Qt::LayoutDirection direction, const QPoint& pos );
00211
00212 private:
00213 class Private;
00214 Private* const d;
00215 };
00216
00217 #endif