KDEUI
kratingwidget.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the Nepomuk KDE project. 00003 * Copyright (C) 2006-2007 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 KRATINGWIDGET_H 00022 #define KRATINGWIDGET_H 00023 00024 #include <QtGui/QFrame> 00025 00026 #include <kdeui_export.h> 00027 00040 class KDEUI_EXPORT KRatingWidget : public QFrame 00041 { 00042 Q_OBJECT 00043 Q_PROPERTY( int rating READ rating WRITE setRating ) 00044 Q_PROPERTY( int maxRating READ maxRating WRITE setMaxRating ) 00045 Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment ) 00046 Q_PROPERTY( bool halfStepsEnabled READ halfStepsEnabled WRITE setHalfStepsEnabled ) 00047 Q_PROPERTY( int spacing READ spacing WRITE setSpacing ) 00048 Q_PROPERTY( QIcon icon READ icon WRITE setIcon ) 00049 00050 public: 00054 KRatingWidget( QWidget* parent = 0 ); 00055 00059 ~KRatingWidget(); 00060 00064 unsigned int rating() const; 00065 00069 int maxRating() const; 00070 00076 Qt::Alignment alignment() const; 00077 00085 Qt::LayoutDirection layoutDirection() const; 00086 00092 int spacing() const; 00093 00094 QSize sizeHint() const; 00095 00103 bool halfStepsEnabled() const; 00104 00111 QIcon icon() const; 00112 00113 Q_SIGNALS: 00117 void ratingChanged( unsigned int rating ); 00118 void ratingChanged( int rating ); 00119 00120 public Q_SLOTS: 00125 void setRating( int rating ); 00126 00130 #ifndef KDE_NO_DEPRECATED 00131 KDE_DEPRECATED void setRating( unsigned int rating ); 00132 #endif 00133 00139 void setMaxRating( int max ); 00140 00144 #ifndef KDE_NO_DEPRECATED 00145 KDE_DEPRECATED void setMaxRating( unsigned int max ); 00146 #endif 00147 00152 void setHalfStepsEnabled( bool enabled ); 00153 00157 #ifndef KDE_NO_DEPRECATED 00158 KDE_DEPRECATED void setOnlyPaintFullSteps( bool ); 00159 #endif 00160 00164 void setSpacing( int ); 00165 00170 void setAlignment( Qt::Alignment align ); 00171 00175 void setLayoutDirection( Qt::LayoutDirection direction ); 00176 00180 void setIcon( const QIcon& icon ); 00181 00185 void setCustomPixmap( const QPixmap& pixmap ); 00186 00193 #ifndef KDE_NO_DEPRECATED 00194 KDE_DEPRECATED void setPixmap( const QPixmap& ); 00195 #endif 00196 00202 void setPixmapSize( int size ); 00203 00204 protected: 00205 void mousePressEvent( QMouseEvent* e ); 00206 void mouseMoveEvent( QMouseEvent* e ); 00207 void leaveEvent( QEvent* e ); 00208 void paintEvent( QPaintEvent* e ); 00209 void resizeEvent( QResizeEvent* e ); 00210 00211 private: 00212 class Private; 00213 Private* const d; 00214 }; 00215 00216 #endif
KDE 4.6 API Reference