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 ResolutionRole 00022 }; 00023 00024 BackgroundDelegate(QObject *listener, 00025 float ratio, QObject *parent = 0); 00026 00027 virtual void paint(QPainter *painter, 00028 const QStyleOptionViewItem &option, 00029 const QModelIndex &index) const; 00030 virtual QSize sizeHint(const QStyleOptionViewItem &option, 00031 const QModelIndex &index) const; 00032 00033 static const int SCREENSHOT_SIZE = 60; 00034 00035 private: 00036 static const int MARGIN = 5; 00037 QObject *m_listener; 00038 float m_ratio; 00039 }; 00040 00041 #endif // BACKGROUNDDELEGATEL_H
KDE 4.4 API Reference