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

Plasma

Plasma::Delegate

Plasma::Delegate Class Reference

Item delegate for rendering items in Plasma menus implemented with item views. More...

#include <Plasma/Delegate>

Inheritance diagram for Plasma::Delegate:
QAbstractItemDelegate

List of all members.

Public Types

enum  ColumnType { MainColumn = 1, SecondaryActionColumn = 2 }
enum  SpecificRoles { SubTitleRole = Qt::UserRole + 1, SubTitleMandatoryRole = Qt::UserRole + 2, ColumnTypeRole = Qt::UserRole + 3 }

Public Member Functions

 Delegate (QObject *parent=0)
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
int roleMapping (SpecificRoles role) const
void setRoleMapping (SpecificRoles role, int actual)
bool showToolTip () const
 ~Delegate ()

Protected Member Functions

QRect emptyRect (const QStyleOptionViewItem &option, const QModelIndex &index) const
QRect rectAfterSubTitle (const QStyleOptionViewItem &option, const QModelIndex &index) const
QRect rectAfterTitle (const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const

Detailed Description

Item delegate for rendering items in Plasma menus implemented with item views.

The delegate makes use of its own data roles that are: SubTitleRole: the text of the subtitle SubTitleMandatoryRole: if the subtitle is to always be displayed (as default the subtitle is displayed only on mouse over) ColumnTypeRole: if the column is a main column (with title and subtitle) or a secondary action column (only a little icon that appears on mouse over is displayed)

Definition at line 48 of file delegate.h.


Member Enumeration Documentation

enum Plasma::Delegate::ColumnType
Enumerator:
MainColumn 
SecondaryActionColumn 

Definition at line 59 of file delegate.h.

enum Plasma::Delegate::SpecificRoles
Enumerator:
SubTitleRole 
SubTitleMandatoryRole 
ColumnTypeRole 

Definition at line 53 of file delegate.h.


Constructor & Destructor Documentation

Plasma::Delegate::Delegate ( QObject *  parent = 0  ) 

Definition at line 145 of file delegate.cpp.

Plasma::Delegate::~Delegate (  ) 

Definition at line 154 of file delegate.cpp.


Member Function Documentation

QRect Plasma::Delegate::emptyRect ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [protected]

Returns the empty area after both the title and the subtitle.

The height is the height of the item. It can be used by subclasses that wants to paint additional data

Parameters:
option options for the title and subtitle text
index model index that we want to compute the free area

Definition at line 207 of file delegate.cpp.

void Plasma::Delegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [virtual]

Definition at line 218 of file delegate.cpp.

QRect Plasma::Delegate::rectAfterSubTitle ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [protected]

Returns the empty area after the subtitle.

The height is the height of the subtitle. It can be used by subclasses, that wants to paint additional data.

Parameters:
option options for the subtitle text
index model index that we want to compute the free area

Definition at line 188 of file delegate.cpp.

QRect Plasma::Delegate::rectAfterTitle ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [protected]

Returns the empty area after the title.

The height is the height of the subtitle. It can be used by subclasses that wants to paint additional data after calling the paint function of the superclass.

Parameters:
option options for the title text
index model index that we want to compute the free area

Definition at line 169 of file delegate.cpp.

int Plasma::Delegate::roleMapping ( SpecificRoles  role  )  const

Definition at line 164 of file delegate.cpp.

void Plasma::Delegate::setRoleMapping ( SpecificRoles  role,
int  actual 
)

Maps an arbitrary role to a role belonging to SpecificRoles.

Using this function you can use any model with this delegate.

Parameters:
role a role belonging to SpecificRoles
actual an arbitrary role of the model we are using

Definition at line 159 of file delegate.cpp.

bool Plasma::Delegate::showToolTip (  )  const
Returns:
true if a tooltip should be shown

Definition at line 470 of file delegate.cpp.

QSize Plasma::Delegate::sizeHint ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [protected, virtual]

Definition at line 446 of file delegate.cpp.


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

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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