legendiface_ext.patch
python/gui/qgslegendinterface.sip (working copy) | ||
---|---|---|
39 | 39 |
//! Move a layer to a group |
40 | 40 |
virtual void moveLayer( QgsMapLayer * layer, int groupIndex ) =0; |
41 | 41 | |
42 |
//! Collapse or expand a group |
|
43 |
//! @note added in 1.5 |
|
44 |
virtual void setGroupExpanded( int groupIndex, bool expand ) =0; |
|
45 | ||
46 |
//! Set visibility of a layer or group |
|
47 |
//! @note added in 1.5 |
|
48 |
virtual void setItemVisible( int index, bool visible ) =0; |
|
49 | ||
42 | 50 |
//! refresh layer symbology |
43 |
//! \note added in 1.5
|
|
51 |
//! @note added in 1.5
|
|
44 | 52 |
virtual void refreshLayerSymbology( QgsMapLayer *layer ) =0; |
45 | 53 |
}; |
46 | 54 |
src/app/legend/qgsapplegendinterface.h (working copy) | ||
---|---|---|
61 | 61 |
//! Update an index |
62 | 62 |
void updateIndex( QModelIndex oldIndex, QModelIndex newIndex ); |
63 | 63 | |
64 |
//! Collapse or expand a group |
|
65 |
void setGroupExpanded( int groupIndex, bool expand ); |
|
66 | ||
67 |
//! Set the visibility of a layer or group |
|
68 |
void setItemVisible( int index, bool visible ); |
|
69 | ||
64 | 70 |
//! refresh layer symbology |
65 | 71 |
void refreshLayerSymbology( QgsMapLayer *ml ); |
66 | 72 |
src/app/legend/qgsapplegendinterface.cpp (working copy) | ||
---|---|---|
54 | 54 |
} |
55 | 55 |
} |
56 | 56 | |
57 |
void QgsAppLegendInterface::setGroupExpanded( int groupIndex, bool expand ) |
|
58 |
{ |
|
59 |
mLegend->setExpanded( mLegend->model()->index( groupIndex, 0 ), expand ); |
|
60 |
} |
|
61 | ||
62 |
void QgsAppLegendInterface::setItemVisible( int index, bool visible ) |
|
63 |
{ |
|
64 |
if ( mLegend->topLevelItemCount() <= index || 0 > index ) |
|
65 |
{ |
|
66 |
return; |
|
67 |
} |
|
68 | ||
69 |
Qt::CheckState state = visible ? Qt::Checked : Qt::Unchecked; |
|
70 |
mLegend->topLevelItem( index )->setCheckState( 0, state ); |
|
71 |
} |
|
72 | ||
57 | 73 |
QStringList QgsAppLegendInterface::groups() |
58 | 74 |
{ |
59 | 75 |
return mLegend->groups(); |
src/gui/qgslegendinterface.h (working copy) | ||
---|---|---|
64 | 64 |
//! Move a layer to a group |
65 | 65 |
virtual void moveLayer( QgsMapLayer * ml, int groupIndex ) = 0; |
66 | 66 | |
67 |
//! Collapse or expand a group |
|
68 |
//! @note added in 1.5 |
|
69 |
virtual void setGroupExpanded( int groupIndex, bool expand ) = 0; |
|
70 | ||
71 |
//! Set the visibility of a layer or group |
|
72 |
//! @note added in 1.5 |
|
73 |
virtual void setItemVisible( int index, bool visible ) = 0; |
|
74 | ||
67 | 75 |
//! Refresh layer symbology |
68 |
// @noted added in 1.5
|
|
76 |
//! @note added in 1.5
|
|
69 | 77 |
virtual void refreshLayerSymbology( QgsMapLayer *ml ) = 0; |
70 | 78 |
}; |
71 | 79 |