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

KDEUI

  • 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
28class QIcon;
29class QPixmap;
30class QPainter;
31class QPoint;
32class QRect;
33
34
50class KDEUI_EXPORT KRatingPainter
51{
52public:
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
214private:
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:51
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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