Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgsdetaileditemdelegate.h - A rich QItemDelegate subclass 00003 ------------------- 00004 begin : Sat May 17 2008 00005 copyright : (C) 2008 Tim Sutton 00006 email : [email protected] 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 #ifndef QGSDETAILEDITEMDELEGATE_H 00018 #define QGSDETAILEDITEMDELEGATE_H 00019 00020 #include <QAbstractItemDelegate> 00021 #include <QString> 00022 00023 class QCheckBox; 00024 class QgsDetailedItemWidget; 00025 class QgsDetailedItemData; 00026 class QFontMetrics; 00027 class QFont; 00028 00034 class GUI_EXPORT QgsDetailedItemDelegate : 00035 public QAbstractItemDelegate 00036 { 00037 Q_OBJECT 00038 public: 00039 QgsDetailedItemDelegate( QObject * parent = 0 ); 00040 ~QgsDetailedItemDelegate(); 00042 void paint( QPainter * thePainter, 00043 const QStyleOptionViewItem & theOption, 00044 const QModelIndex & theIndex ) const; 00046 QSize sizeHint( const QStyleOptionViewItem & theOption, 00047 const QModelIndex & theIndex ) const; 00048 00049 void setVerticalSpacing( int theValue ); 00050 00051 int verticalSpacing() const; 00052 00053 void setHorizontalSpacing( int theValue ); 00054 00055 int horizontalSpacing() const; 00056 00057 private: 00058 QFont detailFont( const QStyleOptionViewItem &theOption ) const; 00059 QFont categoryFont( 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