[composer] Recalculate table size when margin or grid width changes

This commit is contained in:
Nyall Dawson 2014-04-27 19:31:55 +10:00
parent 8feb9ae9af
commit 48c3b99f7b
2 changed files with 24 additions and 3 deletions

View File

@ -136,6 +136,13 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
}
}
void QgsComposerTable::setLineTextDistance( double d )
{
mLineTextDistance = d;
//since spacing has changed, we need to recalculate the table size
adjustFrameToSize();
}
void QgsComposerTable::setHeaderFont( const QFont& f )
{
mHeaderFont = f;
@ -150,6 +157,20 @@ void QgsComposerTable::setContentFont( const QFont& f )
adjustFrameToSize();
}
void QgsComposerTable::setShowGrid( bool show )
{
mShowGrid = show;
//since grid spacing has changed, we need to recalculate the table size
adjustFrameToSize();
}
void QgsComposerTable::setGridStrokeWidth( double w )
{
mGridStrokeWidth = w;
//since grid spacing has changed, we need to recalculate the table size
adjustFrameToSize();
}
void QgsComposerTable::adjustFrameToSize()
{
//check how much space each column needs

View File

@ -43,7 +43,7 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const = 0;
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc ) = 0;
void setLineTextDistance( double d ) { mLineTextDistance = d; }
void setLineTextDistance( double d );
double lineTextDistance() const { return mLineTextDistance; }
void setHeaderFont( const QFont& f );
@ -52,10 +52,10 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
void setContentFont( const QFont& f );
QFont contentFont() const { return mContentFont; }
void setShowGrid( bool show ) { mShowGrid = show;}
void setShowGrid( bool show );
bool showGrid() const { return mShowGrid; }
void setGridStrokeWidth( double w ) { mGridStrokeWidth = w; }
void setGridStrokeWidth( double w );
double gridStrokeWidth() const { return mGridStrokeWidth; }
void setGridColor( const QColor& c ) { mGridColor = c; }