Skip to content
Permalink
Browse files

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

  • Loading branch information
nyalldawson committed Apr 27, 2014
1 parent 8feb9ae commit 48c3b99f7b025ba8bb84f3d93faf9e194f21e446
Showing with 24 additions and 3 deletions.
  1. +21 −0 src/core/composer/qgscomposertable.cpp
  2. +3 −3 src/core/composer/qgscomposertable.h
@@ -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
@@ -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; }

0 comments on commit 48c3b99

Please sign in to comment.
You can’t perform that action at this time.