1
/***************************************************************************
2
qgsdetaileditemdelegate.h - A rich QItemDelegate subclass
4
begin : Sat May 17 2008
5
copyright : (C) 2008 Tim Sutton
6
email : tim@linfiniti.com
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#ifndef QGSDETAILEDITEMDELEGATE_H
19
#define QGSDETAILEDITEMDELEGATE_H
21
#include <QAbstractItemDelegate>
25
class QgsDetailedItemWidget;
26
class QgsDetailedItemData;
31
* A custom model/view delegate that can display an icon, heading
32
* and detail sections.
33
* @see also QgsDetailedItemData
35
class GUI_EXPORT QgsDetailedItemDelegate :
36
public QAbstractItemDelegate
40
QgsDetailedItemDelegate( QObject * parent = 0 );
41
~QgsDetailedItemDelegate();
42
/** reimplement for parent class */
43
void paint( QPainter * thePainter,
44
const QStyleOptionViewItem & theOption,
45
const QModelIndex & theIndex ) const;
46
/** reimplement for parent class */
47
QSize sizeHint( const QStyleOptionViewItem & theOption,
48
const QModelIndex & theIndex ) const;
50
void setVerticalSpacing( int theValue );
52
int verticalSpacing() const;
54
void setHorizontalSpacing( int theValue );
56
int horizontalSpacing() const;
59
QFont detailFont( const QStyleOptionViewItem &theOption ) const;
60
QFont titleFont( const QStyleOptionViewItem &theOption ) const;
61
void drawHighlight( const QStyleOptionViewItem &theOption,
62
QPainter * thepPainter,
63
int theHeight ) const;
65
QStringList wordWrap( QString theString,
66
QFontMetrics theMetrics,
68
void paintManually( QPainter * thePainter,
69
const QStyleOptionViewItem & theOption,
70
const QgsDetailedItemData theData ) const;
71
void paintAsWidget( QPainter * thePainter,
72
const QStyleOptionViewItem & theOption,
73
const QgsDetailedItemData theData ) const;
74
int height( const QStyleOptionViewItem & theOption,
75
const QgsDetailedItemData theData ) const;
76
QgsDetailedItemWidget * mpWidget;
77
QCheckBox * mpCheckBox;
79
int mHorizontalSpacing;
82
#endif //QGSDETAILEDITEMDELEGATE_H