Skip to content

Commit 514c49d

Browse files
committedSep 1, 2014
Improve docs for QgsLegendSymbolItemV2
1 parent 872fe7a commit 514c49d

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed
 

‎src/core/composer/qgscomposerlegenditem.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,8 @@ void QgsComposerSymbolV2Item::readXML( const QDomElement& itemElem, bool xServer
171171
return;
172172
}
173173

174-
mItem.setLabel( itemElem.attribute( "text", "" ) );
175174
setUserText( itemElem.attribute( "userText", "" ) );
176175
QDomElement symbolsElem = itemElem.firstChildElement( "symbols" );
177-
if ( !symbolsElem.isNull() )
178-
{
179-
QgsSymbolV2Map loadSymbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem );
180-
//we assume there is only one symbol in the map...
181-
QgsSymbolV2Map::iterator mapIt = loadSymbolMap.begin();
182-
if ( mapIt != loadSymbolMap.end() )
183-
{
184-
QgsSymbolV2* symbolNg = mapIt.value();
185-
if ( symbolNg )
186-
{
187-
mItem.setSymbol( symbolNg );
188-
}
189-
}
190-
qDeleteAll( loadSymbolMap );
191-
}
192176
}
193177

194178
void QgsComposerSymbolV2Item::setSymbolV2( QgsSymbolV2* s )

‎src/core/symbology-ng/qgslegendsymbolitemv2.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,43 @@ class QgsSymbolV2;
99
* The class stores information about one class/rule of a vector layer renderer in a unified way
1010
* that can be used by legend model for rendering of legend.
1111
*
12+
* @see QgsSymbolV2LegendNode
1213
* @note added in 2.6
1314
*/
1415
class CORE_EXPORT QgsLegendSymbolItemV2
1516
{
1617
public:
1718
QgsLegendSymbolItemV2();
18-
//! construct item, does not take ownership of symbol (makes internal clone)
19+
//! Construct item. Does not take ownership of symbol (makes internal clone)
1920
QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString& label, const QString& ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1 );
2021
~QgsLegendSymbolItemV2();
2122
QgsLegendSymbolItemV2( const QgsLegendSymbolItemV2& other );
2223
QgsLegendSymbolItemV2& operator=( const QgsLegendSymbolItemV2& other );
2324

25+
//! Return associated symbol. May be null.
2426
QgsSymbolV2* symbol() const { return mSymbol; }
27+
//! Return text label
2528
QString label() const { return mLabel; }
29+
//! Return unique identifier of the rule for identification of the item within renderer
2630
QString ruleKey() const { return mKey; }
31+
//! Return whether the item is user-checkable - whether renderer supports enabling/disabling it
2732
bool isCheckable() const { return mCheckable; }
2833

29-
//! used for older code that identifies legend entries from symbol pointer within renderer
34+
//! Used for older code that identifies legend entries from symbol pointer within renderer
3035
QgsSymbolV2* legacyRuleKey() const { return mOriginalSymbolPointer; }
3136

37+
//! Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0)
3238
bool isScaleOK( double scale ) const;
39+
//! Min scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 1000.
40+
//! Value <= 0 means the range is unbounded on this side
3341
int scaleMinDenom() const { return mScaleMinDenom; }
42+
//! Max scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 2000.
43+
//! Value <= 0 means the range is unbounded on this side
3444
int scaleMaxDenom() const { return mScaleMaxDenom; }
3545

36-
//! takes ownership of symbol
46+
protected:
47+
//! Set symbol of the item. Takes ownership of symbol.
3748
void setSymbol( QgsSymbolV2* s );
38-
void setLabel( const QString& label ) { mLabel = label; }
3949

4050
private:
4151
//! symbol. owned by the struct. can be null.

0 commit comments

Comments
 (0)
Please sign in to comment.