Plasma
backgrounddelegate.h
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 */ 00009 00010 #ifndef BACKGROUNDDELEGATE_H 00011 #define BACKGROUNDDELEGATE_H 00012 00013 #include <QAbstractItemDelegate> 00014 00015 class BackgroundDelegate : public QAbstractItemDelegate 00016 { 00017 public: 00018 enum { 00019 AuthorRole = Qt::UserRole, 00020 ScreenshotRole 00021 }; 00022 00023 BackgroundDelegate(QObject *listener, 00024 float ratio, QObject *parent = 0); 00025 00026 virtual void paint(QPainter *painter, 00027 const QStyleOptionViewItem &option, 00028 const QModelIndex &index) const; 00029 virtual QSize sizeHint(const QStyleOptionViewItem &option, 00030 const QModelIndex &index) const; 00031 00032 private: 00033 static const int MARGIN = 5; 00034 QObject *m_listener; 00035 float m_ratio; 00036 }; 00037 00038 #endif // BACKGROUNDDELEGATEL_H