Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
QgsDetailedItemData - support enabled/disabled states
- Loading branch information
|
@@ -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 |
|
|
|
|
|