• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • widgets
kratingpainter.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _NEPOMUK_RATING_PAINTER_H_
22 #define _NEPOMUK_RATING_PAINTER_H_
23 
24 #include <kdeui_export.h>
25 
26 #include <QtCore/Qt>
27 
28 class QIcon;
29 class QPixmap;
30 class QPainter;
31 class QPoint;
32 class QRect;
33 
34 
50 class KDEUI_EXPORT KRatingPainter
51 {
52 public:
58  KRatingPainter();
59 
63  ~KRatingPainter();
64 
71  int maxRating() const;
72 
80  bool halfStepsEnabled() const;
81 
87  Qt::Alignment alignment() const;
88 
96  Qt::LayoutDirection layoutDirection() const;
97 
104  QIcon icon() const;
105 
112  bool isEnabled() const;
113 
120  QPixmap customPixmap() const;
121 
127  int spacing() const;
128 
132  void setMaxRating( int max );
133 
138  void setHalfStepsEnabled( bool enabled );
139 
144  void setAlignment( Qt::Alignment align );
145 
149  void setLayoutDirection( Qt::LayoutDirection direction );
150 
154  void setIcon( const QIcon& icon );
155 
159  void setEnabled( bool enabled );
160 
164  void setCustomPixmap( const QPixmap& pixmap );
165 
171  void setSpacing( int spacing );
172 
185  void paint( QPainter* painter, const QRect& rect, int rating, int hoverRating = -1 ) const;
186 
193  int ratingFromPosition( const QRect& rect, const QPoint& pos ) const;
194 
203  static void paintRating( QPainter* p, const QRect& rect, Qt::Alignment align, int rating, int hoverRating = -1 );
204 
212  static int getRatingFromPosition( const QRect& rect, Qt::Alignment align, Qt::LayoutDirection direction, const QPoint& pos );
213 
214 private:
215  class Private;
216  Private* const d;
217 };
218 
219 #endif
KRatingPainter
Utility class that draws a row of stars for a rating value.
Definition: kratingpainter.h:50
QPoint
QRect
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal