Skip to content
Permalink
Browse files

Possibility to adapt composer table rect to content size before painting

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13326 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 19, 2010
1 parent 38e0d17 commit 57ed537a693f48bc3b003d726676683d43ee80e3
Showing with 20 additions and 0 deletions.
  1. +16 −0 src/core/composer/qgscomposertable.cpp
  2. +4 −0 src/core/composer/qgscomposertable.h
@@ -110,6 +110,22 @@ void QgsComposerTable::paint( QPainter* painter, const QStyleOptionGraphicsItem*
}
}

void QgsComposerTable::adjustFrameToSize()
{
QList<QgsAttributeMap> attributes;
if ( !getFeatureAttributes( attributes ) )
{
return;
}

QMap<int, double> maxWidthMap;
if ( !calculateMaxColumnWidths( maxWidthMap, attributes ) )
{
return;
}
adaptItemFrame( maxWidthMap, attributes );
}

bool QgsComposerTable::tableWriteXML( QDomElement& elem, QDomDocument & doc ) const
{
elem.setAttribute( "lineTextDist", mLineTextDistance );
@@ -55,6 +55,10 @@ class CORE_EXPORT QgsComposerTable: public QgsComposerItem
void setGridColor( const QColor& c ) { mGridColor = c; }
QColor gridColor() const { return mGridColor; }

/**Adapts the size of the frame to match the content. This is normally done in the paint method, but sometimes \
it needs to be done before the first render*/
void adjustFrameToSize();

protected:
/**Distance between table lines and text*/
double mLineTextDistance;

0 comments on commit 57ed537

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