File indexing completed on 2024-06-23 05:28:19
0001 /* 0002 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com> 0003 Copyright 2013 by Reza Fatahilah Shah <rshah0385@kireihana.com> 0004 0005 This program is free software: you can redistribute it and/or modify 0006 it under the terms of the GNU General Public License as published by 0007 the Free Software Foundation, either version 2 of the License, or 0008 (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 #ifndef THEMESDELEGATE_H 0019 #define THEMESDELEGATE_H 0020 0021 #include <QAbstractItemDelegate> 0022 0023 class ThemesDelegate : public QAbstractItemDelegate 0024 { 0025 public: 0026 explicit ThemesDelegate(QObject *parent = 0); 0027 0028 virtual void paint(QPainter *painter, 0029 const QStyleOptionViewItem &option, 0030 const QModelIndex &index) const; 0031 virtual QSize sizeHint(const QStyleOptionViewItem &option, 0032 const QModelIndex &index) const; 0033 void setPreviewSize(const QSize &size); 0034 0035 static const int SCREENSHOT_SIZE = 128; 0036 static const int BLUR_INCREMENT = 9; 0037 static const int MARGIN = 6; 0038 0039 void resetMaxHeight() { m_maxHeight = 0; } 0040 int m_maxHeight; 0041 0042 private: 0043 int m_maxWidth; 0044 QSize mSize; 0045 }; 0046 0047 #endif //THEMESDELEGATE_H