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

KDEUI

Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties
KRatingWidget Class Reference

#include <KDE/KRatingWidget>

Inheritance diagram for KRatingWidget:
Inheritance graph
[legend]

List of all members.

Public Slots

void setAlignment (Qt::Alignment align)
void setCustomPixmap (const QPixmap &pixmap)
void setHalfStepsEnabled (bool enabled)
void setIcon (const QIcon &icon)
void setLayoutDirection (Qt::LayoutDirection direction)
void setMaxRating (int max)
void setMaxRating (unsigned int max)
void setOnlyPaintFullSteps (bool)
void setPixmap (const QPixmap &)
void setPixmapSize (int size)
void setRating (int rating)
void setRating (unsigned int rating)
void setSpacing (int)

Signals

void ratingChanged (unsigned int rating)
void ratingChanged (int rating)

Public Member Functions

 KRatingWidget (QWidget *parent=0)
 ~KRatingWidget ()
Qt::Alignment alignment () const
bool halfStepsEnabled () const
QIcon icon () const
Qt::LayoutDirection layoutDirection () const
int maxRating () const
unsigned int rating () const
QSize sizeHint () const
int spacing () const

Protected Member Functions

void leaveEvent (QEvent *e)
void mouseMoveEvent (QMouseEvent *e)
void mousePressEvent (QMouseEvent *e)
void paintEvent (QPaintEvent *e)
void resizeEvent (QResizeEvent *e)

Properties

Qt::Alignment alignment
bool halfStepsEnabled
QIcon icon
int maxRating
int rating
int spacing

Detailed Description

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.

See also:
KRatingPainter
Author:
Sebastian Trueg <trueg@kde.org>

Constructor & Destructor Documentation

KRatingWidget::KRatingWidget ( QWidget *  parent = 0)

Creates a new rating widget.

Definition at line 48 of file kratingwidget.cpp.

KRatingWidget::~KRatingWidget ( )

Destructor.

Definition at line 56 of file kratingwidget.cpp.


Member Function Documentation

Qt::Alignment KRatingWidget::alignment ( ) const

The alignment of the stars.

See also:
setAlignment
bool KRatingWidget::halfStepsEnabled ( ) const

If half steps are enabled one star equals to 2 rating points and uneven rating values result in half-stars being drawn.

See also:
setHalfStepsEnabled
QIcon KRatingWidget::icon ( ) const

The icon used to draw a star.

In case a custom pixmap has been set this value is ignored.

See also:
setIcon, setCustomPixmap
Qt::LayoutDirection KRatingWidget::layoutDirection ( ) const

The layout direction.

If RTL the stars representing the rating value will be drawn from the right.

See also:
setLayoutDirection

Definition at line 123 of file kratingwidget.cpp.

void KRatingWidget::leaveEvent ( QEvent *  e) [protected]

Definition at line 227 of file kratingwidget.cpp.

int KRatingWidget::maxRating ( ) const
Returns:
the maximum possible rating.
void KRatingWidget::mouseMoveEvent ( QMouseEvent *  e) [protected]

Definition at line 213 of file kratingwidget.cpp.

void KRatingWidget::mousePressEvent ( QMouseEvent *  e) [protected]

Definition at line 204 of file kratingwidget.cpp.

void KRatingWidget::paintEvent ( QPaintEvent *  e) [protected]

Definition at line 234 of file kratingwidget.cpp.

unsigned int KRatingWidget::rating ( ) const
Returns:
The current rating.
void KRatingWidget::ratingChanged ( unsigned int  rating) [signal]

This signal is emitted when the rating is changed.

void KRatingWidget::ratingChanged ( int  rating) [signal]
void KRatingWidget::resizeEvent ( QResizeEvent *  e) [protected]

Definition at line 259 of file kratingwidget.cpp.

void KRatingWidget::setAlignment ( Qt::Alignment  align) [slot]

The alignment of the stars in the drawing rect.

All alignment flags are supported.

Definition at line 116 of file kratingwidget.cpp.

void KRatingWidget::setCustomPixmap ( const QPixmap &  pixmap) [slot]

Set a custom pixmap.

Definition at line 70 of file kratingwidget.cpp.

void KRatingWidget::setHalfStepsEnabled ( bool  enabled) [slot]

If half steps are enabled (the default) then one rating step corresponds to half a star.

Definition at line 189 of file kratingwidget.cpp.

void KRatingWidget::setIcon ( const QIcon &  icon) [slot]

Set a custom icon.

Defaults to "rating".

Definition at line 77 of file kratingwidget.cpp.

void KRatingWidget::setLayoutDirection ( Qt::LayoutDirection  direction) [slot]

LTR or RTL.

Definition at line 129 of file kratingwidget.cpp.

void KRatingWidget::setMaxRating ( int  max) [slot]

Set the maximum allowed rating value.

The default is 10 which means that a rating from 1 to 10 is selectable. If max is uneven steps are automatically only allowed full.

Definition at line 182 of file kratingwidget.cpp.

void KRatingWidget::setMaxRating ( unsigned int  max) [slot]
Deprecated:
use setMaxRating( int max )

Definition at line 175 of file kratingwidget.cpp.

void KRatingWidget::setOnlyPaintFullSteps ( bool  fs) [slot]
Deprecated:
Use setHalfStepsEnabled

Definition at line 197 of file kratingwidget.cpp.

void KRatingWidget::setPixmap ( const QPixmap &  pix) [slot]

Set the pixap to be used to display a rating step.

By default the "rating" pixmap is loaded.

Deprecated:
use setCustomPixmap

Definition at line 63 of file kratingwidget.cpp.

void KRatingWidget::setPixmapSize ( int  size) [slot]

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.

Definition at line 84 of file kratingwidget.cpp.

void KRatingWidget::setRating ( int  rating) [slot]

Set the current rating.

Calling this method will trigger the ratingChanged signal if rating is different from the previous rating.

Definition at line 162 of file kratingwidget.cpp.

void KRatingWidget::setRating ( unsigned int  rating) [slot]
Deprecated:
use setRating( int rating )

Definition at line 155 of file kratingwidget.cpp.

void KRatingWidget::setSpacing ( int  s) [slot]

Set the spacing between the pixmaps.

The default is 0.

Definition at line 103 of file kratingwidget.cpp.

QSize KRatingWidget::sizeHint ( void  ) const

Definition at line 243 of file kratingwidget.cpp.

int KRatingWidget::spacing ( ) const

The spacing between the rating stars.

See also:
setSpacing

Property Documentation

Qt::Alignment KRatingWidget::alignment [read, write]

Definition at line 45 of file kratingwidget.h.

bool KRatingWidget::halfStepsEnabled [read, write]

Definition at line 46 of file kratingwidget.h.

QIcon KRatingWidget::icon [read, write]

Definition at line 48 of file kratingwidget.h.

int KRatingWidget::maxRating [read, write]

Definition at line 44 of file kratingwidget.h.

unsigned int KRatingWidget::rating [read, write]

Definition at line 43 of file kratingwidget.h.

int KRatingWidget::spacing [read, write]

Definition at line 47 of file kratingwidget.h.


The documentation for this class was generated from the following files:
  • kratingwidget.h
  • kratingwidget.cpp

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal