Skip to content
Permalink
Browse files

QgsDetailedItemData - support enabled/disabled states

git-svn-id: http://svn.osgeo.org/qgis/trunk@9650 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 17, 2008
1 parent f928413 commit edd6c414f0b9e29f4986c9632acec75470e263fc
Showing with 14 additions and 0 deletions.
  1. +10 −0 src/gui/qgsdetaileditemdata.cpp
  2. +3 −0 src/gui/qgsdetaileditemdata.h
  3. +1 −0 src/gui/qgsdetaileditemdelegate.cpp
@@ -20,6 +20,7 @@
QgsDetailedItemData::QgsDetailedItemData()
{
mRenderAsWidgetFlag = false;
mEnabledFlag = true;
}

QgsDetailedItemData::~QgsDetailedItemData()
@@ -83,3 +84,12 @@ bool QgsDetailedItemData::isRenderedAsWidget() const
return mRenderAsWidgetFlag;
}

void QgsDetailedItemData::setEnabled( bool theFlag )
{
mEnabledFlag = theFlag;
}

bool QgsDetailedItemData::isEnabled() const
{
return mEnabledFlag;
}
@@ -37,6 +37,7 @@ class GUI_EXPORT QgsDetailedItemData
void setIcon( const QPixmap theIcon );
void setCheckable( const bool theFlag );
void setChecked( const bool theFlag );
void setEnabled( bool theFlag );
/** This is a hint to the delegate to render using
* a widget rather than manually painting every
* part of the list item.
@@ -50,6 +51,7 @@ class GUI_EXPORT QgsDetailedItemData
QPixmap icon() const;
bool isCheckable() const;
bool isChecked() const;
bool isEnabled() const;
bool isRenderedAsWidget() const;

private:
@@ -59,6 +61,7 @@ class GUI_EXPORT QgsDetailedItemData
QPixmap mPixmap;
bool mCheckableFlag;
bool mCheckedFlag;
bool mEnabledFlag;
bool mRenderAsWidgetFlag;
};

@@ -102,6 +102,7 @@ void QgsDetailedItemDelegate::paintManually( QPainter * thepPainter,
//
//bool myCheckState = theIndex.model()->data(theIndex, Qt::CheckStateRole).toBool();
mpCheckBox->setChecked( theData.isChecked() );
mpCheckBox->setEnabled( theData.isEnabled() );
QPixmap myCbxPixmap( mpCheckBox->size() );
mpCheckBox->render( &myCbxPixmap ); //we will draw this onto the widget further down

0 comments on commit edd6c41

Please sign in to comment.