Skip to content

Commit

Permalink
QgsDetailedItemData - support enabled/disabled states
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9650 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 17, 2008
1 parent f928413 commit edd6c41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/qgsdetaileditemdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
QgsDetailedItemData::QgsDetailedItemData()
{
mRenderAsWidgetFlag = false;
mEnabledFlag = true;
}

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

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

bool QgsDetailedItemData::isEnabled() const
{
return mEnabledFlag;
}
3 changes: 3 additions & 0 deletions src/gui/qgsdetaileditemdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -50,6 +51,7 @@ class GUI_EXPORT QgsDetailedItemData
QPixmap icon() const;
bool isCheckable() const;
bool isChecked() const;
bool isEnabled() const;
bool isRenderedAsWidget() const;

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

Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsdetaileditemdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit edd6c41

Please sign in to comment.