KDEUI
kratingpainter.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the Nepomuk KDE project. 00003 Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef _NEPOMUK_RATING_PAINTER_H_ 00022 #define _NEPOMUK_RATING_PAINTER_H_ 00023 00024 #include <kdeui_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 00050 class KDEUI_EXPORT KRatingPainter 00051 { 00052 public: 00058 KRatingPainter(); 00059 00063 ~KRatingPainter(); 00064 00071 int maxRating() const; 00072 00080 bool halfStepsEnabled() const; 00081 00087 Qt::Alignment alignment() const; 00088 00096 Qt::LayoutDirection layoutDirection() const; 00097 00104 QIcon icon() const; 00105 00112 bool isEnabled() const; 00113 00120 QPixmap customPixmap() const; 00121 00127 int spacing() const; 00128 00132 void setMaxRating( int max ); 00133 00138 void setHalfStepsEnabled( bool enabled ); 00139 00144 void setAlignment( Qt::Alignment align ); 00145 00149 void setLayoutDirection( Qt::LayoutDirection direction ); 00150 00154 void setIcon( const QIcon& icon ); 00155 00159 void setEnabled( bool enabled ); 00160 00164 void setCustomPixmap( const QPixmap& pixmap ); 00165 00171 void setSpacing( int spacing ); 00172 00185 void paint( QPainter* painter, const QRect& rect, int rating, int hoverRating = -1 ) const; 00186 00193 int ratingFromPosition( const QRect& rect, const QPoint& pos ) const; 00194 00203 static void paintRating( QPainter* p, const QRect& rect, Qt::Alignment align, int rating, int hoverRating = -1 ); 00204 00212 static int getRatingFromPosition( const QRect& rect, Qt::Alignment align, Qt::LayoutDirection direction, const QPoint& pos ); 00213 00214 private: 00215 class Private; 00216 Private* const d; 00217 }; 00218 00219 #endif
KDE 4.6 API Reference