[QGIS Commit] r8787 - in trunk/qgis/src: app gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jul 15 12:13:38 EDT 2008


Author: timlinux
Date: 2008-07-15 12:13:38 -0400 (Tue, 15 Jul 2008)
New Revision: 8787

Modified:
   trunk/qgis/src/app/qgspluginmanager.cpp
   trunk/qgis/src/gui/qgsdetaileditemdata.cpp
   trunk/qgis/src/gui/qgsdetaileditemdata.h
   trunk/qgis/src/gui/qgsdetaileditemdelegate.cpp
   trunk/qgis/src/gui/qgsdetaileditemdelegate.h
Log:
Refactored detaileditemdelegate to avoid code duplication and try to resolve some issues needed for grass refactoring. Also fixed clipping of checkbox and checkbox logic is not entirely encapsulated based on the values of qgsdetaileditemdata.


Modified: trunk/qgis/src/app/qgspluginmanager.cpp
===================================================================
--- trunk/qgis/src/app/qgspluginmanager.cpp	2008-07-15 16:09:43 UTC (rev 8786)
+++ trunk/qgis/src/app/qgspluginmanager.cpp	2008-07-15 16:13:38 UTC (rev 8787)
@@ -305,15 +305,13 @@
     myData.setTitle(pName());
     myData.setDetail(pDesc());
     myData.setRenderAsWidget(false);
-    QVariant myVariant = qVariantFromValue(myData);
+    myData.setCheckable(true);
+    myData.setChecked(false); //start unchecked - we will check it later if needed
+
     //round trip test - delete this...no need to uncomment
     //QgsDetailedItemData myData2 = qVariantValue<QgsDetailedItemData>(myVariant);
     //Q_ASSERT(myData.title() == myData2.title());
     //round trip test ends
-    mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
-    // Let the first col  have a checkbox
-    mypDetailItem->setCheckable(true);
-    mypDetailItem->setEditable(false);
 
     QgsDebugMsg("Getting an instance of the QgsPluginRegistry");
 
@@ -332,9 +330,11 @@
       if (libName == myLib->fileName())
       {
         // set the checkbox
-        mypDetailItem->setCheckState(Qt::Checked);
+        myData.setChecked(true);
       }
     }
+    QVariant myVariant = qVariantFromValue(myData);
+    mypDetailItem->setData(myVariant,PLUGIN_DATA_ROLE);
     // Add items to model
     mModelPlugins->appendRow(mypDetailItem);
 
@@ -437,8 +437,13 @@
   // select all plugins
   for (int row=0;row < mModelPlugins->rowCount();row++)
   {
-    QStandardItem *myItem=mModelPlugins->item(row,0);
-    myItem->setCheckState(Qt::Checked);
+    QStandardItem *mypItem=mModelPlugins->item(row,0);
+    QgsDetailedItemData myData = 
+        qVariantValue<QgsDetailedItemData>(mypItem->data(PLUGIN_DATA_ROLE));
+    myData.setChecked(true);
+    QVariant myVariant = qVariantFromValue(myData);
+    mypItem->setData(myVariant,PLUGIN_DATA_ROLE);
+    
   }
 }
 
@@ -447,8 +452,12 @@
   // clear all selection checkboxes
   for (int row=0;row < mModelPlugins->rowCount();row++)
   {
-    QStandardItem *myItem=mModelPlugins->item(row,0);
-    myItem->setCheckState(Qt::Unchecked);
+    QStandardItem *mypItem=mModelPlugins->item(row,0);
+    QgsDetailedItemData myData = 
+        qVariantValue<QgsDetailedItemData>(mypItem->data(PLUGIN_DATA_ROLE));
+    myData.setChecked(false);
+    QVariant myVariant = qVariantFromValue(myData);
+    mypItem->setData(myVariant,PLUGIN_DATA_ROLE);
   }
 }
 
@@ -463,14 +472,18 @@
     //
     QStandardItem * mypItem = 
       mModelPlugins->findItems(theIndex.data(Qt ::DisplayRole).toString()).first();
-    if ( mypItem->checkState() == Qt::Checked )
+    QgsDetailedItemData myData = 
+        qVariantValue<QgsDetailedItemData>(mypItem->data(PLUGIN_DATA_ROLE));
+    if ( myData.isChecked() )
     {
-      mypItem->setCheckState(Qt::Unchecked);
+      myData.setChecked(false);
     } 
     else 
     {
-      mypItem->setCheckState(Qt::Checked);
+      myData.setChecked(true);
     }
+    QVariant myVariant = qVariantFromValue(myData);
+    mypItem->setData(myVariant,PLUGIN_DATA_ROLE);
   }
 }
 

Modified: trunk/qgis/src/gui/qgsdetaileditemdata.cpp
===================================================================
--- trunk/qgis/src/gui/qgsdetaileditemdata.cpp	2008-07-15 16:09:43 UTC (rev 8786)
+++ trunk/qgis/src/gui/qgsdetaileditemdata.cpp	2008-07-15 16:13:38 UTC (rev 8787)
@@ -26,59 +26,59 @@
 {
 }
 
-void QgsDetailedItemData::setTitle(QString theTitle)
+void QgsDetailedItemData::setTitle(const QString theTitle)
 {
   mTitle=theTitle;
 }
 
-void QgsDetailedItemData::setDetail(QString theDetail)
+void QgsDetailedItemData::setDetail(const QString theDetail)
 {
   mDetail=theDetail;
 }
 
-void QgsDetailedItemData::setIcon(QPixmap theIcon)
+void QgsDetailedItemData::setIcon(const QPixmap theIcon)
 {
   mPixmap = theIcon;
 }
-void QgsDetailedItemData::setCheckable(bool theFlag)
+void QgsDetailedItemData::setCheckable(const bool theFlag)
 {
   mCheckableFlag = theFlag;
 }
-void QgsDetailedItemData::setChecked(bool theFlag)
+void QgsDetailedItemData::setChecked(const bool theFlag)
 {
   mCheckedFlag = theFlag;
 }
-void QgsDetailedItemData::setRenderAsWidget(bool theFlag)
+void QgsDetailedItemData::setRenderAsWidget(const bool theFlag)
 {
   mRenderAsWidgetFlag = theFlag;
 }
 
-QString QgsDetailedItemData::title()
+QString QgsDetailedItemData::title() const
 {
   return mTitle;
 }
 
-QString QgsDetailedItemData::detail()
+QString QgsDetailedItemData::detail() const
 {
   return mDetail;
 }
 
-QPixmap QgsDetailedItemData::icon()
+QPixmap QgsDetailedItemData::icon() const
 {
   return mPixmap;
 }
 
-bool QgsDetailedItemData::isCheckable()
+bool QgsDetailedItemData::isCheckable() const
 {
   return mCheckableFlag;
 }
 
-bool QgsDetailedItemData::isChecked()
+bool QgsDetailedItemData::isChecked() const
 {
   return mCheckedFlag;
 }
 
-bool QgsDetailedItemData::isRenderedAsWidget()
+bool QgsDetailedItemData::isRenderedAsWidget() const
 {
   return mRenderAsWidgetFlag;
 }

Modified: trunk/qgis/src/gui/qgsdetaileditemdata.h
===================================================================
--- trunk/qgis/src/gui/qgsdetaileditemdata.h	2008-07-15 16:09:43 UTC (rev 8786)
+++ trunk/qgis/src/gui/qgsdetaileditemdata.h	2008-07-15 16:13:38 UTC (rev 8787)
@@ -31,11 +31,11 @@
   public:
     QgsDetailedItemData();
     ~QgsDetailedItemData();
-    void setTitle(QString theTitle);
-    void setDetail(QString theDetail);
-    void setIcon(QPixmap theIcon);
-    void setCheckable(bool theFlag);
-    void setChecked(bool theFlag);
+    void setTitle(const QString theTitle);
+    void setDetail(const QString theDetail);
+    void setIcon(const QPixmap theIcon);
+    void setCheckable(const bool theFlag);
+    void setChecked(const bool theFlag);
     /** This is a hint to the delegate to render using 
      * a widget rather than manually painting every 
      * part of the list item.
@@ -44,12 +44,12 @@
      */
     void setRenderAsWidget(bool theFlag);
 
-    QString title();
-    QString detail();
-    QPixmap icon();
-    bool isCheckable();
-    bool isChecked();
-    bool isRenderedAsWidget();
+    QString title() const;
+    QString detail() const;
+    QPixmap icon() const;
+    bool isCheckable() const;
+    bool isChecked() const;
+    bool isRenderedAsWidget() const;
 
   private:
     QString mTitle;

Modified: trunk/qgis/src/gui/qgsdetaileditemdelegate.cpp
===================================================================
--- trunk/qgis/src/gui/qgsdetaileditemdelegate.cpp	2008-07-15 16:09:43 UTC (rev 8786)
+++ trunk/qgis/src/gui/qgsdetaileditemdelegate.cpp	2008-07-15 16:13:38 UTC (rev 8787)
@@ -33,7 +33,9 @@
        
 {
   //mpWidget->setFixedHeight(80);
-  mpCheckBox->resize(16,16);
+  mpCheckBox->resize(mpCheckBox->sizeHint().height(),mpCheckBox->sizeHint().height());
+  setVerticalSpacing (3);
+  setHorizontalSpacing (5);
 }
 
 QgsDetailedItemDelegate::~QgsDetailedItemDelegate()
@@ -55,138 +57,18 @@
     bool myCheckState = theIndex.model()->data(theIndex, Qt::CheckStateRole).toBool();
     if (myData.isRenderedAsWidget())
     {
-      mpWidget->setChecked(myCheckState);
-      mpWidget->setData(myData);
-      mpWidget->resize(theOption.rect.width(),mpWidget->height());
-      mpWidget->setAutoFillBackground(false);
-      mpWidget->repaint();
-
-      if (theOption.state & QStyle::State_Selected)
-      {
-        QColor myColor1 = theOption.palette.highlight().color();
-        QColor myColor2 = myColor1;
-        myColor2 = myColor2.lighter(110); //10% lighter
-        QLinearGradient myGradient(QPointF(0,theOption.rect.y()),
-            QPointF(0,theOption.rect.y() + mpWidget->height()));
-        myGradient.setColorAt(0, myColor1);
-        myGradient.setColorAt(0.1, myColor2);
-        myGradient.setColorAt(0.5, myColor1);
-        myGradient.setColorAt(0.9, myColor2);
-        myGradient.setColorAt(1, myColor1);
-        thepPainter->fillRect(theOption.rect, QBrush(myGradient));
-      }
-      QPixmap myPixmap = QPixmap::grabWidget(mpWidget);
-      thepPainter->drawPixmap(theOption.rect.x(),
-          theOption.rect.y(), 
-          myPixmap);
-    } //render as widget 
+      paintAsWidget(thepPainter,theOption,myData);
+    } 
     else //render by manually painting
     {
-      //
-      // Get the strings and check box properties
-      //
-      bool myCheckState = theIndex.model()->data(theIndex, Qt::CheckStateRole).toBool();
-      mpCheckBox->setChecked(myCheckState);
-      QPixmap myCbxPixmap(mpCheckBox->size());
-      mpCheckBox->render(&myCbxPixmap); //we will draw this onto the widget further down
-
-      //
-      // Calculate the widget height and other metrics
-      //
-      QFont myFont = theOption.font;
-      QFont myTitleFont = myFont;
-      myTitleFont.setBold(true);
-      myTitleFont.setPointSize(myFont.pointSize() + 3);
-      QFontMetrics myTitleMetrics(myTitleFont);
-      QFontMetrics myDetailMetrics(myFont);
-      int myVerticalSpacer = 3; //spacing between title and description
-      int myHorizontalSpacer = 5; //spacing between checkbox / icon and description
-      int myTextStartX = theOption.rect.x() + myHorizontalSpacer;
-      int myTextStartY= theOption.rect.y() + myVerticalSpacer;
-      int myHeight = myTitleMetrics.height() + myVerticalSpacer;
-
-      //
-      // Draw the item background with a gradient if its highlighted
-      //
-      if (theOption.state & QStyle::State_Selected)
-      {
-        QColor myColor1 = theOption.palette.highlight().color();
-        QColor myColor2 = myColor1;
-        myColor2 = myColor2.lighter(110); //10% lighter
-        int myHeight = myTitleMetrics.height() + myVerticalSpacer;
-        QLinearGradient myGradient(QPointF(0,theOption.rect.y()),
-            QPointF(0,theOption.rect.y() + myHeight*2));
-        myGradient.setColorAt(0, myColor1);
-        myGradient.setColorAt(0.1, myColor2);
-        myGradient.setColorAt(0.5, myColor1);
-        myGradient.setColorAt(0.9, myColor2);
-        myGradient.setColorAt(1, myColor2);
-        thepPainter->fillRect(theOption.rect, QBrush(myGradient));
-      }
-
-      //
-      // Draw the checkbox
-      //
-      bool myCheckableFlag = true;
-      if (theIndex.flags() == Qt::ItemIsUserCheckable)
-      {
-        myCheckableFlag = false;
-      }
-      if (myCheckableFlag)
-      {
-        thepPainter->drawPixmap(theOption.rect.x(),
-            theOption.rect.y() + mpCheckBox->height(), 
-            myCbxPixmap);
-        myTextStartX = theOption.rect.x() + myCbxPixmap.width() + myHorizontalSpacer;
-      }
-      //
-      // Draw the decoration (pixmap)
-      //
-      bool myIconFlag = false;
-      QPixmap myDecoPixmap = myData.icon();
-      if (!myDecoPixmap.isNull())
-      {
-        thepPainter->drawPixmap(myTextStartX,
-            myTextStartY + (myDecoPixmap.height() / 2), 
-            myDecoPixmap);
-        myTextStartX += myDecoPixmap.width() + myHorizontalSpacer;
-      }
-      //
-      // Draw the title 
-      //
-      myTextStartY += myHeight/2;
-      thepPainter->setFont(myTitleFont);
-      thepPainter->drawText( myTextStartX ,
-          myTextStartY , 
-          myData.title());
-      //
-      // Draw the description with word wrapping if needed
-      //
-      thepPainter->setFont(myFont); //return to original font set by client
-      if (myIconFlag)
-      {
-        myTextStartY += myVerticalSpacer;
-      }
-      else
-      {
-        myTextStartY +=  myDetailMetrics.height() + myVerticalSpacer;
-      }
-      QStringList myList = 
-        wordWrap( myData.detail(), myDetailMetrics, theOption.rect.width() - myTextStartX );
-      QStringListIterator myLineWrapIterator(myList);
-      while (myLineWrapIterator.hasNext())
-      {
-        QString myLine = myLineWrapIterator.next();
-        thepPainter->drawText( myTextStartX, 
-            myTextStartY,
-            myLine);
-        myTextStartY += myDetailMetrics.height() - myVerticalSpacer;
-      }
-    } //render by manual painting
+      paintManually(thepPainter,theOption,myData);
+    }
   } //can convert item data
   thepPainter->restore();
 }
 
+
+
 QSize QgsDetailedItemDelegate::sizeHint( 
        const QStyleOptionViewItem & theOption, 
        const QModelIndex & theIndex ) const
@@ -201,22 +83,8 @@
     }
     else // fall back to hand calculated & hand drawn item
     {
-      QFont myFont = theOption.font;
-      QFont myTitleFont = myFont;
-      myTitleFont.setBold(true);
-      myTitleFont.setPointSize(myFont.pointSize() + 3);
-      QFontMetrics myTitleMetrics(myTitleFont);
-      QFontMetrics myDetailMetrics(myFont);
-      int myVerticalSpacer = 3; //spacing between title and description
-      int myHorizontalSpacer = 5; //spacing between checkbox / icon and description
-      int myHeight = myTitleMetrics.height() + myVerticalSpacer;
-      QString myDetailString = theIndex.model()->data(theIndex, Qt::UserRole).toString();
-      QStringList myList = wordWrap( myDetailString, 
-          myDetailMetrics, 
-          theOption.rect.width() - (mpCheckBox->width() + myHorizontalSpacer));
-      myHeight += (myList.count() + 1) * (myDetailMetrics.height() - myVerticalSpacer);
       //for some reason itmes are non selectable if using rect.width() on osx and win
-      return QSize(50, myHeight + myVerticalSpacer);
+      return QSize(50, height(theOption,myData));
       //return QSize(theOption.rect.width(), myHeight + myVerticalSpacer);
     }
   }
@@ -226,6 +94,162 @@
   }
 }
 
+void QgsDetailedItemDelegate::paintManually(QPainter * thepPainter, 
+                       const QStyleOptionViewItem & theOption,
+                       const QgsDetailedItemData theData) const
+{
+    //
+      // Get the strings and check box properties
+    //
+    //bool myCheckState = theIndex.model()->data(theIndex, Qt::CheckStateRole).toBool();
+    mpCheckBox->setChecked(theData.isChecked());
+    QPixmap myCbxPixmap(mpCheckBox->size());
+    mpCheckBox->render(&myCbxPixmap); //we will draw this onto the widget further down
+
+    //
+      // Calculate the widget height and other metrics
+    //
+
+    QFontMetrics myTitleMetrics(titleFont(theOption));
+    QFontMetrics myDetailMetrics(detailFont(theOption));
+    int myTextStartX = theOption.rect.x() + horizontalSpacing();
+    int myTextStartY= theOption.rect.y() + verticalSpacing();
+    int myHeight = myTitleMetrics.height() + verticalSpacing();
+
+    //
+      // Draw the item background with a gradient if its highlighted
+    //
+    if (theOption.state & QStyle::State_Selected)
+    {
+      drawHighlight(theOption,thepPainter, height(theOption, theData));
+    }
+
+    //
+    // Draw the checkbox
+    //
+    if (theData.isCheckable())
+    {
+      thepPainter->drawPixmap(theOption.rect.x(),
+                              theOption.rect.y() + mpCheckBox->height(), 
+                                               myCbxPixmap);
+      myTextStartX = theOption.rect.x() + myCbxPixmap.width() + horizontalSpacing();
+    }
+    //
+      // Draw the decoration (pixmap)
+    //
+    bool myIconFlag = false;
+    QPixmap myDecoPixmap = theData.icon();
+    if (!myDecoPixmap.isNull())
+    {
+      thepPainter->drawPixmap(myTextStartX,
+                              myTextStartY + (myDecoPixmap.height() / 2), 
+                                              myDecoPixmap);
+      myTextStartX += myDecoPixmap.width() + horizontalSpacing();
+    }
+    //
+      // Draw the title 
+    //
+    myTextStartY += myHeight/2;
+    thepPainter->setFont(titleFont(theOption));
+    thepPainter->drawText( myTextStartX ,
+                           myTextStartY , 
+                           theData.title());
+    //
+      // Draw the description with word wrapping if needed
+    //
+    thepPainter->setFont(detailFont(theOption)); //return to original font set by client
+    if (myIconFlag)
+    {
+      myTextStartY += verticalSpacing();
+    }
+    else
+    {
+      myTextStartY +=  myDetailMetrics.height() + verticalSpacing();
+    }
+    QStringList myList = 
+        wordWrap( theData.detail(), myDetailMetrics, theOption.rect.width() - myTextStartX );
+    QStringListIterator myLineWrapIterator(myList);
+    while (myLineWrapIterator.hasNext())
+    {
+      QString myLine = myLineWrapIterator.next();
+      thepPainter->drawText( myTextStartX, 
+                             myTextStartY,
+                             myLine);
+      myTextStartY += myDetailMetrics.height() - verticalSpacing();
+    }
+  } //render by manual painting
+
+
+void QgsDetailedItemDelegate::paintAsWidget(QPainter * thepPainter, 
+                       const QStyleOptionViewItem & theOption,
+                       const QgsDetailedItemData theData) const
+{
+  QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &theOption, thepPainter, 0);
+  mpWidget->setChecked(theData.isChecked());
+  mpWidget->setData(theData);
+  mpWidget->resize(theOption.rect.width(),mpWidget->height());
+  mpWidget->setAutoFillBackground(true);
+      //mpWidget->setAttribute(Qt::WA_OpaquePaintEvent);
+  mpWidget->repaint();
+
+  if (theOption.state & QStyle::State_Selected)
+  {
+    drawHighlight(theOption,thepPainter,height(theOption,theData));
+  }
+  QPixmap myPixmap = QPixmap::grabWidget(mpWidget);
+  thepPainter->drawPixmap(theOption.rect.x(),
+                          theOption.rect.y(), 
+                          myPixmap);
+}//render as widget 
+
+void QgsDetailedItemDelegate::drawHighlight(const QStyleOptionViewItem &theOption,
+                                            QPainter * thepPainter,
+                                            int theHeight) const
+{
+  QColor myColor1 = theOption.palette.highlight().color();
+  QColor myColor2 = myColor1;
+  myColor2 = myColor2.lighter(110); //10% lighter
+  QLinearGradient myGradient(QPointF(0,theOption.rect.y()),
+                             QPointF(0,theOption.rect.y() + theHeight));
+  myGradient.setColorAt(0, myColor1);
+  myGradient.setColorAt(0.1, myColor2);
+  myGradient.setColorAt(0.5, myColor1);
+  myGradient.setColorAt(0.9, myColor2);
+  myGradient.setColorAt(1, myColor2);
+  thepPainter->fillRect(theOption.rect, QBrush(myGradient));
+}
+
+int QgsDetailedItemDelegate::height(const QStyleOptionViewItem & theOption,
+                                     const QgsDetailedItemData theData) const
+{  
+  QFontMetrics myTitleMetrics( titleFont( theOption ) );
+  QFontMetrics myDetailMetrics( detailFont( theOption ) );
+  //we dont word wrap the title so its easy to measure
+  int myHeight = myTitleMetrics.height() + verticalSpacing();
+  //the detail needs to be measured though
+  QStringList myList = wordWrap( theData.detail(),
+                                 myDetailMetrics,
+                                 theOption.rect.width() - ( mpCheckBox->width() + horizontalSpacing() ) );
+  myHeight += ( myList.count() + 1 ) * ( myDetailMetrics.height() - verticalSpacing() );
+  return myHeight;
+}
+
+
+QFont QgsDetailedItemDelegate::detailFont(const QStyleOptionViewItem &theOption) const
+{
+  QFont myFont = theOption.font;
+  return myFont;
+}
+
+QFont QgsDetailedItemDelegate::titleFont(const QStyleOptionViewItem &theOption) const
+{
+  QFont myTitleFont = detailFont(theOption);
+  myTitleFont.setBold(true);
+  myTitleFont.setPointSize(myTitleFont.pointSize() + 1);
+  return myTitleFont;
+}
+
+
 QStringList QgsDetailedItemDelegate::wordWrap(QString theString, 
                                     QFontMetrics theMetrics, 
                                     int theWidth) const
@@ -272,3 +296,27 @@
 
 }
 
+
+
+int QgsDetailedItemDelegate::verticalSpacing() const
+{
+  return mVerticalSpacing;
+}
+
+
+void QgsDetailedItemDelegate::setVerticalSpacing( int theValue )
+{
+  mVerticalSpacing = theValue;
+}
+
+
+int QgsDetailedItemDelegate::horizontalSpacing() const
+{
+  return mHorizontalSpacing;
+}
+
+
+void QgsDetailedItemDelegate::setHorizontalSpacing( int theValue )
+{
+  mHorizontalSpacing = theValue;
+}

Modified: trunk/qgis/src/gui/qgsdetaileditemdelegate.h
===================================================================
--- trunk/qgis/src/gui/qgsdetaileditemdelegate.h	2008-07-15 16:09:43 UTC (rev 8786)
+++ trunk/qgis/src/gui/qgsdetaileditemdelegate.h	2008-07-15 16:13:38 UTC (rev 8787)
@@ -23,7 +23,9 @@
 
 class QCheckBox;
 class QgsDetailedItemWidget;
+class QgsDetailedItemData;
 class QFontMetrics;
+class QFont;
 
 class GUI_EXPORT QgsDetailedItemDelegate : 
      public QAbstractItemDelegate 
@@ -32,17 +34,47 @@
   public:
     QgsDetailedItemDelegate(QObject * parent = 0);
     ~QgsDetailedItemDelegate();
+    /** reimplement for parent class */
     void paint(QPainter * thePainter, 
                const QStyleOptionViewItem & theOption,
                const QModelIndex & theIndex) const;
+    /** reimplement for parent class */
     QSize sizeHint( const QStyleOptionViewItem & theOption, 
                const QModelIndex & theIndex ) const;
+
+	void setVerticalSpacing( int theValue );
+	
+	int verticalSpacing() const;
+
+	void setHorizontalSpacing( int theValue );
+	
+	int horizontalSpacing() const;
+	
+	
+    
+
   private:
+    QFont detailFont(const QStyleOptionViewItem &theOption) const;
+    QFont titleFont(const QStyleOptionViewItem &theOption) const;
+    void drawHighlight(const QStyleOptionViewItem &theOption,
+        QPainter * thepPainter,
+        int theHeight) const;
+    
     QStringList wordWrap(QString theString, 
                          QFontMetrics theMetrics, 
                          int theWidth) const;
+    void paintManually(QPainter * thePainter, 
+                       const QStyleOptionViewItem & theOption,
+                       const QgsDetailedItemData theData) const;
+    void paintAsWidget(QPainter * thePainter, 
+                       const QStyleOptionViewItem & theOption,
+                       const QgsDetailedItemData theData) const;
+    int height(const QStyleOptionViewItem & theOption,
+               const QgsDetailedItemData theData) const;
     QgsDetailedItemWidget * mpWidget;
     QCheckBox * mpCheckBox;
+    int mVerticalSpacing;
+    int mHorizontalSpacing;
 };
 
 #endif //QGSDETAILEDITEMDELEGATE_H



More information about the QGIS-commit mailing list