Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 qgsdetaileditemdelegate.h - A rich QItemDelegate subclass 00003 ------------------- 00004 begin : Sat May 17 2008 00005 copyright : (C) 2008 Tim Sutton 00006 email : tim@linfiniti.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 /* $Id:$ */ 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