/usr/include/nepomuk/kratingwidget.h is in kdelibs5-dev 4:4.8.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /*
* This file is part of the Nepomuk KDE project.
* Copyright (C) 2006-2007 Sebastian Trueg <trueg@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KRATINGWIDGET_H
#define KRATINGWIDGET_H
#include <QtGui/QFrame>
#include <kdeui_export.h>
/**
* \class KRatingWidget kratingwidget.h KDE/KRatingWidget
*
* \brief Displays a rating value as a row of pixmaps.
*
* The KRatingWidget displays a range of stars or other arbitrary
* pixmaps and allows the user to select a certain number by mouse.
*
* \sa KRatingPainter
*
* \author Sebastian Trueg <trueg@kde.org>
*/
class KDEUI_EXPORT KRatingWidget : public QFrame
{
Q_OBJECT
Q_PROPERTY( int rating READ rating WRITE setRating )
Q_PROPERTY( int maxRating READ maxRating WRITE setMaxRating )
Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment )
Q_PROPERTY( bool halfStepsEnabled READ halfStepsEnabled WRITE setHalfStepsEnabled )
Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
Q_PROPERTY( QIcon icon READ icon WRITE setIcon )
public:
/**
* Creates a new rating widget.
*/
KRatingWidget( QWidget* parent = 0 );
/**
* Destructor
*/
~KRatingWidget();
/**
* \return The current rating.
*/
unsigned int rating() const;
/**
* \return the maximum possible rating.
*/
int maxRating() const;
/**
* The alignment of the stars.
*
* \sa setAlignment
*/
Qt::Alignment alignment() const;
/**
* The layout direction. If RTL the stars
* representing the rating value will be drawn from the
* right.
*
* \sa setLayoutDirection
*/
Qt::LayoutDirection layoutDirection() const;
/**
* The spacing between the rating stars.
*
* \sa setSpacing
*/
int spacing() const;
QSize sizeHint() const;
/**
* If half steps are enabled one star equals to 2 rating
* points and uneven rating values result in half-stars being
* drawn.
*
* \sa setHalfStepsEnabled
*/
bool halfStepsEnabled() const;
/**
* The icon used to draw a star. In case a custom pixmap has been set
* this value is ignored.
*
* \sa setIcon, setCustomPixmap
*/
QIcon icon() const;
Q_SIGNALS:
/**
* This signal is emitted when the rating is changed.
*/
void ratingChanged( unsigned int rating );
void ratingChanged( int rating );
public Q_SLOTS:
/**
* Set the current rating. Calling this method will trigger the
* ratingChanged signal if @p rating is different from the previous rating.
*/
void setRating( int rating );
/**
* \deprecated use setRating( int rating )
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED void setRating( unsigned int rating );
#endif
/**
* Set the maximum allowed rating value. The default is 10 which means
* that a rating from 1 to 10 is selectable. If \a max is uneven steps
* are automatically only allowed full.
*/
void setMaxRating( int max );
/**
* \deprecated use setMaxRating( int max )
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED void setMaxRating( unsigned int max );
#endif
/**
* If half steps are enabled (the default) then
* one rating step corresponds to half a star.
*/
void setHalfStepsEnabled( bool enabled );
/**
* \deprecated Use setHalfStepsEnabled
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED void setOnlyPaintFullSteps( bool );
#endif
/**
* Set the spacing between the pixmaps. The default is 0.
*/
void setSpacing( int );
/**
* The alignment of the stars in the drawing rect.
* All alignment flags are supported.
*/
void setAlignment( Qt::Alignment align );
/**
* LTR or RTL
*/
void setLayoutDirection( Qt::LayoutDirection direction );
/**
* Set a custom icon. Defaults to "rating".
*/
void setIcon( const QIcon& icon );
/**
* Set a custom pixmap.
*/
void setCustomPixmap( const QPixmap& pixmap );
/**
* Set the pixap to be used to display a rating step.
* By default the "rating" pixmap is loaded.
*
* \deprecated use setCustomPixmap
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED void setPixmap( const QPixmap& );
#endif
/**
* Set the recommended size of the pixmaps. This is
* only used for the sizeHint. The actual size is always
* dependent on the size of the widget itself.
*/
void setPixmapSize( int size );
protected:
void mousePressEvent( QMouseEvent* e );
void mouseMoveEvent( QMouseEvent* e );
void leaveEvent( QEvent* e );
void paintEvent( QPaintEvent* e );
void resizeEvent( QResizeEvent* e );
private:
class Private;
Private* const d;
};
#endif
|