Skip to content

Commit

Permalink
[FEATURE][composer] New composer item for multi frame attribute tables.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nyalldawson committed Sep 17, 2014
1 parent 993aa83 commit cb73905
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/core/composer/qgscomposerattributetablev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ void QgsComposerAttributeTableV2::addFrame( QgsComposerFrame *frame, bool recalc

if ( recalcFrameSizes )
{

recalculateFrameSizes();
}
}
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermultiframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 5 additions & 13 deletions src/core/composer/qgscomposertablev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/core/composer/qgscomposertablev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cb73905

Please sign in to comment.