[FEATURE][composer] New composer item for multi frame attribute tables.

Allows table content to be spread over multiple frames. Note:
existing table items are not automatically upgraded to multiframe
tables (to avoid API breaks with plugins), so only newly added
tables gain these new options.

QgsComposerTable is effectively deprecated and will be removed at the
next API break.

This work was sponsored by the City of Uster, Switzerland.
This commit is contained in:
Nyall Dawson 2014-09-16 21:15:02 +10:00
parent 993aa83306
commit cb73905644
4 changed files with 9 additions and 14 deletions

View File

@ -582,6 +582,7 @@ void QgsComposerAttributeTableV2::addFrame( QgsComposerFrame *frame, bool recalc
if ( recalcFrameSizes )
{
recalculateFrameSizes();
}
}

View File

@ -142,7 +142,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
* this may cause new frames to be added or frames to be removed, in order to fit
* the current size of the multiframe's content.
*/
void recalculateFrameSizes();
virtual void recalculateFrameSizes();
/**Forces a recalculation of all the associated frame's scene rectangles. This
* method is useful for multiframes which implement a minFrameSize() or

View File

@ -136,13 +136,6 @@ bool QgsComposerTableV2::readXML( const QDomElement &itemElem, const QDomDocumen
QSizeF QgsComposerTableV2::totalSize() const
{
//TODO - handle multiple cell headers
//also check height calculation function
//calculate total size
return mTableSize;
}
@ -526,11 +519,12 @@ void QgsComposerTableV2::refreshAttributes()
{
return;
}
}
//since contents have changed, we also need to recalculate the column widths
//and size of table
//gettablecontents does this!
// adjustFrameToSize();
void QgsComposerTableV2::recalculateFrameSizes()
{
mTableSize = QSizeF( totalWidth(), totalHeight() );
QgsComposerMultiFrame::recalculateFrameSizes();
}
bool QgsComposerTableV2::calculateMaxColumnWidths()
@ -703,8 +697,6 @@ void QgsComposerTableV2::drawVerticalGridLines( QPainter *painter, const QMap<in
void QgsComposerTableV2::adjustFrameToSize()
{
mTableSize = QSizeF( totalWidth(), totalHeight() );
recalculateFrameSizes();
//force recalculation of frame rects, so that they are set to the correct

View File

@ -272,6 +272,8 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame
*/
virtual void refreshAttributes();
void recalculateFrameSizes();
protected:
/**Margin between cell borders and cell text*/
double mCellMargin;