Plasma
delegate.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PLASMA_DELEGATE_H
00022 #define PLASMA_DELEGATE_H
00023
00024
00025 #include <QtGui/QAbstractItemDelegate>
00026
00027
00028 #include <plasma/plasma_export.h>
00029
00030 namespace Plasma
00031 {
00032
00033 class DelegatePrivate;
00034
00048 class PLASMA_EXPORT Delegate : public QAbstractItemDelegate
00049 {
00050 Q_OBJECT
00051 public:
00052
00053 enum SpecificRoles {
00054 SubTitleRole = Qt::UserRole + 1,
00055 SubTitleMandatoryRole = Qt::UserRole + 2,
00056 ColumnTypeRole = Qt::UserRole + 3
00057 };
00058
00059 enum ColumnType {
00060 MainColumn = 1,
00061 SecondaryActionColumn = 2
00062 };
00063
00064 Delegate(QObject *parent = 0);
00065 ~Delegate();
00066
00074 void setRoleMapping(SpecificRoles role, int actual);
00075
00076 int roleMapping(SpecificRoles role) const;
00077
00078
00079 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
00080 const QModelIndex &index) const;
00081
00085 bool showToolTip() const;
00086
00087 protected:
00097 QRect rectAfterTitle(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00098
00107 QRect rectAfterSubTitle(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00108
00117 QRect emptyRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00118
00119 virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00120
00121 private:
00122 DelegatePrivate *const d;
00123 };
00124
00125 }
00126
00127 #endif // PLASMA_DELEGATE_H