libplasma
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 DELEGATE_H
00022 #define 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
00044 class PLASMA_EXPORT Delegate : public QAbstractItemDelegate
00045 {
00046 Q_OBJECT
00047 public:
00048
00049 enum SpecificRoles {
00050 SubTitleRole = Qt::UserRole + 1,
00051 SubTitleMandatoryRole = Qt::UserRole + 2,
00052 ColumnTypeRole = Qt::UserRole + 3
00053 };
00054
00055 enum ColumnType {
00056 MainColumn = 1,
00057 SecondaryActionColumn = 2
00058 };
00059
00060 Delegate(QObject *parent = 0);
00061 ~Delegate();
00062
00070 void setRoleMapping(SpecificRoles role, int actual);
00071
00072 int roleMapping(SpecificRoles role) const;
00073
00074
00075 virtual void paint(QPainter *painter,const QStyleOptionViewItem& option,const QModelIndex& index) const;
00076
00077 protected:
00086 QRect rectAfterTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00087
00096 QRect rectAfterSubTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00097
00106 QRect emptyRect(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00107
00108 virtual QSize sizeHint(const QStyleOptionViewItem& option , const QModelIndex& index) const;
00109
00110 private:
00111 DelegatePrivate * const d;
00112 };
00113
00114 }
00115
00116 #endif // ITEMDELEGATE_H