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
00081 void extendItem(QWidget *extender, const QModelIndex &index);
00082
00087 void contractItem(const QModelIndex &index);
00088
00092 void contractAll();
00093
00097 bool isExtended(const QModelIndex &index) const;
00098
00103 virtual void updateExtenderGeometry(QWidget *extender, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00104
00105 Q_SIGNALS:
00109 void extenderCreated(QWidget *extender, const QModelIndex &index);
00110
00114 void extenderDestroyed(QWidget *extender, const QModelIndex &index);
00115
00116 protected:
00123 QRect extenderRect(QWidget *extender, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00124
00128 void setExtendPixmap(const QPixmap &pixmap);
00129
00133 void setContractPixmap(const QPixmap &pixmap);
00134
00138 QPixmap extendPixmap();
00139
00143 QPixmap contractPixmap();
00144
00145
00146 private:
00147 class Private;
00148 Private *const d;
00149
00150 Q_PRIVATE_SLOT(d, void _k_extenderDestructionHandler(QObject *destroyed))
00151 Q_PRIVATE_SLOT(d, void _k_verticalScroll())
00152 };
00153 #endif // KEXTENDABLEITEMDELEGATE_H