KDEUI
kextendableitemdelegate.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
00022 #ifndef KEXTENDABLEITEMDELEGATE_H
00023 #define KEXTENDABLEITEMDELEGATE_H
00024
00025 #include <QtGui/QStyledItemDelegate>
00026
00027 #include <kdeui_export.h>
00028
00049 class QAbstractItemView;
00050
00051 class KDEUI_EXPORT KExtendableItemDelegate : public QStyledItemDelegate {
00052 Q_OBJECT
00053
00054 public:
00055 enum auxDataRoles {ShowExtensionIndicatorRole = Qt::UserRole + 200};
00056
00062 KExtendableItemDelegate(QAbstractItemView *parent);
00063 virtual ~KExtendableItemDelegate();
00064
00068 virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00069
00073 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00074
00080 void extendItem(QWidget *extender, const QModelIndex &index);
00081
00086 void contractItem(const QModelIndex &index);
00087
00091 void contractAll();
00092
00096 bool isExtended(const QModelIndex &index) const;
00097
00102 virtual void updateExtenderGeometry(QWidget *extender, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00103
00104 Q_SIGNALS:
00108 void extenderCreated(QWidget *extender, const QModelIndex &index);
00109
00113 void extenderDestroyed(QWidget *extender, const QModelIndex &index);
00114
00115 protected:
00122 QRect extenderRect(QWidget *extender, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00123
00127 void setExtendPixmap(const QPixmap &pixmap);
00128
00132 void setContractPixmap(const QPixmap &pixmap);
00133
00137 QPixmap extendPixmap();
00138
00142 QPixmap contractPixmap();
00143
00144
00145 private:
00146 class Private;
00147 Private *const d;
00148
00149 Q_PRIVATE_SLOT(d, void _k_extenderDestructionHandler(QObject *destroyed))
00150 Q_PRIVATE_SLOT(d, void _k_verticalScroll())
00151 };
00152 #endif // KEXTENDABLEITEMDELEGATE_H