KIO
kfileitemdelegate.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 KFILEITEMDELEGATE_H
00023 #define KFILEITEMDELEGATE_H
00024
00025 #include <QtGui/QAbstractItemDelegate>
00026 #include <kio/global.h>
00027
00028
00029 class QAbstractItemModel;
00030 class QAbstractItemView;
00031 class QHelpEvent;
00032 class QModelIndex;
00033 class QPainter;
00034
00035
00066 class KIO_EXPORT KFileItemDelegate : public QAbstractItemDelegate
00067 {
00068 Q_OBJECT
00069
00078 Q_PROPERTY(InformationList information READ showInformation WRITE setShowInformation)
00079
00080
00091 Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor)
00092
00101 Q_PROPERTY(QPointF shadowOffset READ shadowOffset WRITE setShadowOffset)
00102
00111 Q_PROPERTY(qreal shadowBlur READ shadowBlur WRITE setShadowBlur)
00112
00118 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
00119
00127 Q_PROPERTY(bool showToolTipWhenElided READ showToolTipWhenElided WRITE setShowToolTipWhenElided)
00128
00129 Q_ENUMS(Information)
00130
00131
00132 public:
00154 enum Information {
00155 NoInformation,
00156 Size,
00157 Permissions,
00158 OctalPermissions,
00159 Owner,
00160 OwnerAndGroup,
00161 CreationTime,
00162 ModificationTime,
00163 AccessTime,
00164 MimeType,
00165 FriendlyMimeType
00166 };
00167
00168 typedef QList<Information> InformationList;
00169
00170
00176 explicit KFileItemDelegate(QObject *parent = 0);
00177
00178
00182 virtual ~KFileItemDelegate();
00183
00184
00197 virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00198
00199
00221 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00222
00223
00227 virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00228
00229
00233 virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem & option, const QModelIndex &index);
00234
00235
00239 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
00240
00241
00245 virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
00246
00247
00251 virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,const QModelIndex &index) const;
00252
00253
00270 void setShowInformation(const InformationList &list);
00271
00272
00281 void setShowInformation(Information information);
00282
00283
00287 InformationList showInformation() const;
00288
00289
00298 void setShadowColor(const QColor &color);
00299
00300
00306 QColor shadowColor() const;
00307
00308
00314 void setShadowOffset(const QPointF &offset);
00315
00316
00322 QPointF shadowOffset() const;
00323
00324
00330 void setShadowBlur(qreal radius);
00331
00332
00338 qreal shadowBlur() const;
00339
00346 void setMaximumSize(const QSize &size);
00347
00354 QSize maximumSize() const;
00355
00366 void setShowToolTipWhenElided(bool showToolTip);
00367
00378 bool showToolTipWhenElided() const;
00379
00383 virtual bool eventFilter(QObject *object, QEvent *event);
00384
00385
00386 public Q_SLOTS:
00390 bool helpEvent(QHelpEvent * event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index);
00391
00396 QRegion shape(const QStyleOptionViewItem &option, const QModelIndex &index);
00397
00398
00399 private:
00400 class Private;
00401 Private * const d;
00402 Q_DISABLE_COPY(KFileItemDelegate)
00403 };
00404
00405 #endif // KFILEITEMDELEGATE_H
00406
00407