KIO
kfileitemdelegate.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE project 00003 00004 Copyright © 2006-2007, 2008 Fredrik Höglund <fredrik@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KFILEITEMDELEGATE_H 00023 #define KFILEITEMDELEGATE_H 00024 00025 #include <QtGui/QAbstractItemDelegate> 00026 #include <QtGui/QTextOption> 00027 #include <kio/global.h> 00028 00029 00030 class QAbstractItemModel; 00031 class QAbstractItemView; 00032 class QHelpEvent; 00033 class QModelIndex; 00034 class QPainter; 00035 00036 00067 class KIO_EXPORT KFileItemDelegate : public QAbstractItemDelegate 00068 { 00069 Q_OBJECT 00070 00079 Q_PROPERTY(InformationList information READ showInformation WRITE setShowInformation) 00080 00081 00092 Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor) 00093 00102 Q_PROPERTY(QPointF shadowOffset READ shadowOffset WRITE setShadowOffset) 00103 00112 Q_PROPERTY(qreal shadowBlur READ shadowBlur WRITE setShadowBlur) 00113 00119 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) 00120 00128 Q_PROPERTY(bool showToolTipWhenElided READ showToolTipWhenElided WRITE setShowToolTipWhenElided) 00129 00135 Q_PROPERTY(bool jobTransfersVisible READ jobTransfersVisible WRITE setJobTransfersVisible) 00136 00137 Q_ENUMS(Information) 00138 00139 00140 public: 00162 enum Information { 00163 NoInformation, 00164 Size, 00165 Permissions, 00166 OctalPermissions, 00167 Owner, 00168 OwnerAndGroup, 00169 CreationTime, 00170 ModificationTime, 00171 AccessTime, 00172 MimeType, 00173 FriendlyMimeType, 00174 LinkDest, 00175 LocalPathOrUrl, 00176 Comment 00177 }; 00178 00179 typedef QList<Information> InformationList; 00180 00181 00187 explicit KFileItemDelegate(QObject *parent = 0); 00188 00189 00193 virtual ~KFileItemDelegate(); 00194 00195 00208 virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; 00209 00210 00232 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 00233 00234 00238 virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; 00239 00240 00244 virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem & option, const QModelIndex &index); 00245 00246 00250 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; 00251 00252 00256 virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; 00257 00258 00262 virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,const QModelIndex &index) const; 00263 00264 00281 void setShowInformation(const InformationList &list); 00282 00283 00292 void setShowInformation(Information information); 00293 00294 00298 InformationList showInformation() const; 00299 00300 00309 void setShadowColor(const QColor &color); 00310 00311 00317 QColor shadowColor() const; 00318 00319 00325 void setShadowOffset(const QPointF &offset); 00326 00327 00333 QPointF shadowOffset() const; 00334 00335 00341 void setShadowBlur(qreal radius); 00342 00343 00349 qreal shadowBlur() const; 00350 00357 void setMaximumSize(const QSize &size); 00358 00365 QSize maximumSize() const; 00366 00377 void setShowToolTipWhenElided(bool showToolTip); 00378 00389 bool showToolTipWhenElided() const; 00390 00396 QRect iconRect(const QStyleOptionViewItem &option, const QModelIndex &index) const; 00397 00404 void setWrapMode(QTextOption::WrapMode wrapMode); 00405 00412 QTextOption::WrapMode wrapMode() const; 00413 00430 void setJobTransfersVisible(bool jobTransfersVisible); 00431 00437 bool jobTransfersVisible() const; 00438 00442 virtual bool eventFilter(QObject *object, QEvent *event); 00443 00444 public Q_SLOTS: 00448 bool helpEvent(QHelpEvent * event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index); 00449 00454 QRegion shape(const QStyleOptionViewItem &option, const QModelIndex &index); 00455 00456 private: 00457 class Private; 00458 Private * const d; 00459 Q_DISABLE_COPY(KFileItemDelegate) 00460 }; 00461 00462 #endif // KFILEITEMDELEGATE_H 00463 00464 // kate: space-indent on; indent-width 4; replace-tabs on;
KDE 4.6 API Reference