Plasma
#include <Plasma/Delegate>
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) | |
~Delegate () | |
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 |
Public Member Functions inherited from QAbstractItemDelegate | |
QAbstractItemDelegate (QObject *parent) | |
virtual | ~QAbstractItemDelegate () |
void | closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint) |
void | commitData (QWidget *editor) |
virtual QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
virtual bool | editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) |
bool | helpEvent (QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) |
virtual void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const =0 |
virtual void | setEditorData (QWidget *editor, const QModelIndex &index) const |
virtual void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
virtual QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const =0 |
void | sizeHintChanged (const QModelIndex &index) |
virtual void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
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 |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Static Public Member Functions inherited from QAbstractItemDelegate | |
QString | elidedText (const QFontMetrics &fontMetrics, int width, Qt::TextElideMode mode, const QString &text) |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
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) NOTE: if model doesn't return a valid data for SubTitleMandatoryRole (i.e. if it returns QVaraint()) then subtitles will be shown for adjasent items with the same content and not shown otherwise.
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 52 of file delegate.h.
Member Enumeration Documentation
Enumerator | |
---|---|
MainColumn | |
SecondaryActionColumn |
Definition at line 63 of file delegate.h.
Enumerator | |
---|---|
SubTitleRole | |
SubTitleMandatoryRole | |
ColumnTypeRole |
Definition at line 57 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
|
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.
|
virtual |
Definition at line 218 of file delegate.cpp.
|
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.
|
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 485 of file delegate.cpp.
|
protectedvirtual |
Definition at line 461 of file delegate.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.