diff options
| author | Peter Penz <[email protected]> | 2008-03-20 16:58:59 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-20 16:58:59 +0000 |
| commit | a8ada5e6857d6dec25edf8ef57af9f27a91471c1 (patch) | |
| tree | cd76cdcbae8e02405c9d4fb768d51b04384109d6 /src/dolphinfileitemdelegate.h | |
| parent | f738a9ff2ba3a71a6015d388c835ffa7c7e0be02 (diff) | |
QListView does not support having a margin for grids. Originally it has been tried to bypass this by overwriting QListView::visualRect(), but this has some side effects (see #155378 and #155575). The clean approach is to return a proper size hint in the file item delegate.
Currently a custom item delegate has been made for Dolphin, but we'll discuss whether it makes sense providing this feature already in KFileItemDelegate...
BUG: 155378
BUG: 155575
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=788095
Diffstat (limited to 'src/dolphinfileitemdelegate.h')
| -rw-r--r-- | src/dolphinfileitemdelegate.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/dolphinfileitemdelegate.h b/src/dolphinfileitemdelegate.h new file mode 100644 index 000000000..2f0167cd9 --- /dev/null +++ b/src/dolphinfileitemdelegate.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2008 by Peter Penz <[email protected]> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHINFILEITEMDELEGATE_H +#define DOLPHINFILEITEMDELEGATE_H + +#include <kfileitemdelegate.h> + +/** + * @brief Extends KFileItemDelegate with the ability to set + * a maximum size. + */ +class DolphinFileItemDelegate : public KFileItemDelegate +{ + Q_OBJECT + +public: + explicit DolphinFileItemDelegate(QObject* parent = 0); + virtual ~DolphinFileItemDelegate(); + + void setMaximumSize(const QSize& size); + QSize maximumSize() const; + + /** @see QItemDelegate::sizeHint() */ + virtual QSize sizeHint(const QStyleOptionViewItem& option, + const QModelIndex& index) const; + +private: + QSize m_maxSize; +}; + +#endif |
