Skip to content

Commit 48c3b99

Browse files
committedApr 27, 2014
[composer] Recalculate table size when margin or grid width changes
1 parent 8feb9ae commit 48c3b99

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed
 

‎src/core/composer/qgscomposertable.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
136136
}
137137
}
138138

139+
void QgsComposerTable::setLineTextDistance( double d )
140+
{
141+
mLineTextDistance = d;
142+
//since spacing has changed, we need to recalculate the table size
143+
adjustFrameToSize();
144+
}
145+
139146
void QgsComposerTable::setHeaderFont( const QFont& f )
140147
{
141148
mHeaderFont = f;
@@ -150,6 +157,20 @@ void QgsComposerTable::setContentFont( const QFont& f )
150157
adjustFrameToSize();
151158
}
152159

160+
void QgsComposerTable::setShowGrid( bool show )
161+
{
162+
mShowGrid = show;
163+
//since grid spacing has changed, we need to recalculate the table size
164+
adjustFrameToSize();
165+
}
166+
167+
void QgsComposerTable::setGridStrokeWidth( double w )
168+
{
169+
mGridStrokeWidth = w;
170+
//since grid spacing has changed, we need to recalculate the table size
171+
adjustFrameToSize();
172+
}
173+
153174
void QgsComposerTable::adjustFrameToSize()
154175
{
155176
//check how much space each column needs

‎src/core/composer/qgscomposertable.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
4343
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0;
4444
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0;
4545

46-
void setLineTextDistance( double d ) { mLineTextDistance = d; }
46+
void setLineTextDistance( double d );
4747
double lineTextDistance() const { return mLineTextDistance; }
4848

4949
void setHeaderFont( const QFont& f );
@@ -52,10 +52,10 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
5252
void setContentFont( const QFont& f );
5353
QFont contentFont() const { return mContentFont; }
5454

55-
void setShowGrid( bool show ) { mShowGrid = show;}
55+
void setShowGrid( bool show );
5656
bool showGrid() const { return mShowGrid; }
5757

58-
void setGridStrokeWidth( double w ) { mGridStrokeWidth = w; }
58+
void setGridStrokeWidth( double w );
5959
double gridStrokeWidth() const { return mGridStrokeWidth; }
6060

6161
void setGridColor( const QColor& c ) { mGridColor = c; }

0 commit comments

Comments
 (0)
Please sign in to comment.