@@ -322,12 +322,7 @@ bool QgsPropertyCollection::readXml( const QDomElement &collectionElem, const QD
322322//
323323
324324QgsPropertyCollectionStack::QgsPropertyCollectionStack ()
325- : mDirty( false )
326- , mHasActiveProperties( false )
327- , mhasDynamicProperties( false )
328- {
329-
330- }
325+ {}
331326
332327QgsPropertyCollectionStack::~QgsPropertyCollectionStack ()
333328{
@@ -336,17 +331,12 @@ QgsPropertyCollectionStack::~QgsPropertyCollectionStack()
336331
337332QgsPropertyCollectionStack::QgsPropertyCollectionStack ( const QgsPropertyCollectionStack &other )
338333 : QgsAbstractPropertyCollection( other )
339- , mDirty( false )
340- , mHasActiveProperties( false )
341- , mhasDynamicProperties( false )
342334{
343335 clear ();
344336
345337 Q_FOREACH ( QgsPropertyCollection* collection, other.mStack )
346338 {
347339 mStack << new QgsPropertyCollection ( *collection );
348- mHasActiveProperties |= collection->hasActiveProperties ();
349- mhasDynamicProperties |= collection->hasDynamicProperties ();
350340 }
351341}
352342
@@ -358,8 +348,6 @@ QgsPropertyCollectionStack &QgsPropertyCollectionStack::operator=( const QgsProp
358348 Q_FOREACH ( QgsPropertyCollection* collection, other.mStack )
359349 {
360350 mStack << new QgsPropertyCollection ( *collection );
361- mHasActiveProperties |= collection->hasActiveProperties ();
362- mhasDynamicProperties |= collection->hasDynamicProperties ();
363351 }
364352
365353 return *this ;
@@ -374,20 +362,15 @@ void QgsPropertyCollectionStack::clear()
374362{
375363 qDeleteAll ( mStack );
376364 mStack .clear ();
377- mHasActiveProperties = false ;
378- mhasDynamicProperties = false ;
379- mDirty = false ;
380365}
381366
382367void QgsPropertyCollectionStack::appendCollection ( QgsPropertyCollection* collection )
383368{
384369 mStack .append ( collection );
385- mDirty = true ;
386370}
387371
388372QgsPropertyCollection* QgsPropertyCollectionStack::at ( int index )
389373{
390- mDirty = true ;
391374 return mStack .value ( index );
392375}
393376
@@ -398,7 +381,6 @@ const QgsPropertyCollection* QgsPropertyCollectionStack::at( int index ) const
398381
399382QgsPropertyCollection* QgsPropertyCollectionStack::collection ( const QString &name )
400383{
401- mDirty = true ;
402384 Q_FOREACH ( QgsPropertyCollection* collection, mStack )
403385 {
404386 if ( collection->name () == name )
@@ -409,18 +391,22 @@ QgsPropertyCollection* QgsPropertyCollectionStack::collection( const QString &na
409391
410392bool QgsPropertyCollectionStack::hasActiveProperties () const
411393{
412- if ( mDirty )
413- rescan ();
414-
415- return mHasActiveProperties ;
394+ Q_FOREACH ( const QgsPropertyCollection* collection, mStack )
395+ {
396+ if ( collection->hasActiveProperties () )
397+ return true ;
398+ }
399+ return false ;
416400}
417401
418402bool QgsPropertyCollectionStack::hasDynamicProperties () const
419403{
420- if ( mDirty )
421- rescan ();
422-
423- return mhasDynamicProperties;
404+ Q_FOREACH ( const QgsPropertyCollection* collection, mStack )
405+ {
406+ if ( collection->hasDynamicProperties () )
407+ return true ;
408+ }
409+ return false ;
424410}
425411
426412bool QgsPropertyCollectionStack::isActive ( int key ) const
@@ -524,20 +510,5 @@ bool QgsPropertyCollectionStack::readXml( const QDomElement& collectionElem, con
524510 child->readXml ( childElem, doc, definitions );
525511 mStack .append ( child );
526512 }
527- mDirty = true ;
528513 return true ;
529514}
530-
531- void QgsPropertyCollectionStack::rescan () const
532- {
533- mHasActiveProperties = false ;
534- mhasDynamicProperties = false ;
535- Q_FOREACH ( const QgsPropertyCollection* collection, mStack )
536- {
537- mHasActiveProperties |= collection->hasActiveProperties ();
538- mhasDynamicProperties |= collection->hasDynamicProperties ();
539- if ( mHasActiveProperties && mhasDynamicProperties )
540- break ;
541- }
542- mDirty = false ;
543- }
0 commit comments