00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QGSDETAILEDITEMDELEGATE_H
00019 #define QGSDETAILEDITEMDELEGATE_H
00020
00021 #include <QAbstractItemDelegate>
00022 #include <QString>
00023
00024 class QCheckBox;
00025 class QgsDetailedItemWidget;
00026 class QgsDetailedItemData;
00027 class QFontMetrics;
00028 class QFont;
00029
00035 class GUI_EXPORT QgsDetailedItemDelegate :
00036 public QAbstractItemDelegate
00037 {
00038 Q_OBJECT
00039 public:
00040 QgsDetailedItemDelegate( QObject * parent = 0 );
00041 ~QgsDetailedItemDelegate();
00043 void paint( QPainter * thePainter,
00044 const QStyleOptionViewItem & theOption,
00045 const QModelIndex & theIndex ) const;
00047 QSize sizeHint( const QStyleOptionViewItem & theOption,
00048 const QModelIndex & theIndex ) const;
00049
00050 void setVerticalSpacing( int theValue );
00051
00052 int verticalSpacing() const;
00053
00054 void setHorizontalSpacing( int theValue );
00055
00056 int horizontalSpacing() const;
00057
00058 private:
00059 QFont detailFont( const QStyleOptionViewItem &theOption ) const;
00060 QFont titleFont( const QStyleOptionViewItem &theOption ) const;
00061 void drawHighlight( const QStyleOptionViewItem &theOption,
00062 QPainter * thepPainter,
00063 int theHeight ) const;
00064
00065 QStringList wordWrap( QString theString,
00066 QFontMetrics theMetrics,
00067 int theWidth ) const;
00068 void paintManually( QPainter * thePainter,
00069 const QStyleOptionViewItem & theOption,
00070 const QgsDetailedItemData theData ) const;
00071 void paintAsWidget( QPainter * thePainter,
00072 const QStyleOptionViewItem & theOption,
00073 const QgsDetailedItemData theData ) const;
00074 int height( const QStyleOptionViewItem & theOption,
00075 const QgsDetailedItemData theData ) const;
00076 QgsDetailedItemWidget * mpWidget;
00077 QCheckBox * mpCheckBox;
00078 int mVerticalSpacing;
00079 int mHorizontalSpacing;
00080 };
00081
00082 #endif //QGSDETAILEDITEMDELEGATE_H