Skip to content

Commit

Permalink
[composer] Recalculate table size when margin or grid width changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 27, 2014
1 parent 8feb9ae commit 48c3b99
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions src/core/composer/qgscomposertable.cpp
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposertable.h
Expand Up @@ -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 );
Expand All @@ -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; }
Expand Down

0 comments on commit 48c3b99

Please sign in to comment.