@@ -34,6 +34,7 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition* composition )
34
34
: QgsComposerItem( composition )
35
35
, mTitle( tr( " Legend" ) )
36
36
, mBoxSpace( 2 )
37
+ , mColumnSpace( 2 )
37
38
, mGroupSpace( 2 )
38
39
, mLayerSpace( 2 )
39
40
, mSymbolSpace( 2 )
@@ -117,14 +118,13 @@ QSizeF QgsComposerLegend::paintAndDetermineSize( QPainter* painter )
117
118
if ( atom.column > column )
118
119
{
119
120
// Switch to next column
120
- // Using mBoxSpace for inter column space
121
121
if ( mEqualColumnWidth )
122
122
{
123
- point.rx () += mBoxSpace + maxColumnWidth;
123
+ point.rx () += mColumnSpace + maxColumnWidth;
124
124
}
125
125
else
126
126
{
127
- point.rx () += mBoxSpace + columnWidth;
127
+ point.rx () += mColumnSpace + columnWidth;
128
128
}
129
129
point.ry () = columnTop;
130
130
columnWidth = 0 ;
@@ -290,7 +290,6 @@ QSizeF QgsComposerLegend::drawLayerItemTitle( QgsComposerLayerItem* layerItem, Q
290
290
291
291
void QgsComposerLegend::adjustBoxSize ()
292
292
{
293
- mColumns .clear ();
294
293
QSizeF size = paintAndDetermineSize ( 0 );
295
294
QgsDebugMsg ( QString ( " width = %1 height = %2" ).arg ( size.width () ).arg ( size.height () ) );
296
295
if ( size.isValid () )
@@ -642,7 +641,6 @@ QStringList QgsComposerLegend::layerIdList() const
642
641
void QgsComposerLegend::synchronizeWithModel ()
643
642
{
644
643
QgsDebugMsg ( " Entered" );
645
- mColumns .clear ();
646
644
adjustBoxSize ();
647
645
update ();
648
646
}
@@ -656,23 +654,20 @@ void QgsComposerLegend::setTitleFont( const QFont& f )
656
654
657
655
void QgsComposerLegend::setGroupFont ( const QFont& f )
658
656
{
659
- mColumns .clear ();
660
657
mGroupFont = f;
661
658
adjustBoxSize ();
662
659
update ();
663
660
}
664
661
665
662
void QgsComposerLegend::setLayerFont ( const QFont& f )
666
663
{
667
- mColumns .clear ();
668
664
mLayerFont = f;
669
665
adjustBoxSize ();
670
666
update ();
671
667
}
672
668
673
669
void QgsComposerLegend::setItemFont ( const QFont& f )
674
670
{
675
- mColumns .clear ();
676
671
mItemFont = f;
677
672
adjustBoxSize ();
678
673
update ();
@@ -724,6 +719,7 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
724
719
composerLegendElem.setAttribute ( " layerFont" , mLayerFont .toString () );
725
720
composerLegendElem.setAttribute ( " itemFont" , mItemFont .toString () );
726
721
composerLegendElem.setAttribute ( " boxSpace" , QString::number ( mBoxSpace ) );
722
+ composerLegendElem.setAttribute ( " columnSpace" , QString::number ( mColumnSpace ) );
727
723
composerLegendElem.setAttribute ( " groupSpace" , QString::number ( mGroupSpace ) );
728
724
composerLegendElem.setAttribute ( " layerSpace" , QString::number ( mLayerSpace ) );
729
725
composerLegendElem.setAttribute ( " symbolSpace" , QString::number ( mSymbolSpace ) );
@@ -785,6 +781,7 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
785
781
786
782
// spaces
787
783
mBoxSpace = itemElem.attribute ( " boxSpace" , " 2.0" ).toDouble ();
784
+ mColumnSpace = itemElem.attribute ( " columnSpace" , " 2.0" ).toDouble ();
788
785
mGroupSpace = itemElem.attribute ( " groupSpace" , " 3.0" ).toDouble ();
789
786
mLayerSpace = itemElem.attribute ( " layerSpace" , " 3.0" ).toDouble ();
790
787
mSymbolSpace = itemElem.attribute ( " symbolSpace" , " 2.0" ).toDouble ();
@@ -822,7 +819,6 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
822
819
823
820
void QgsComposerLegend::setComposerMap ( const QgsComposerMap* map )
824
821
{
825
- mColumns .clear ();
826
822
mComposerMap = map;
827
823
if ( map )
828
824
{
@@ -832,7 +828,10 @@ void QgsComposerLegend::setComposerMap( const QgsComposerMap* map )
832
828
833
829
void QgsComposerLegend::invalidateCurrentMap ()
834
830
{
835
- disconnect ( mComposerMap , SIGNAL ( destroyed ( QObject* ) ), this , SLOT ( invalidateCurrentMap () ) );
831
+ if ( mComposerMap )
832
+ {
833
+ disconnect ( mComposerMap , SIGNAL ( destroyed ( QObject* ) ), this , SLOT ( invalidateCurrentMap () ) );
834
+ }
836
835
mComposerMap = 0 ;
837
836
}
838
837
0 commit comments