QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Attributes | List of all members
QgsComposerMultiFrame Class Referenceabstract

Abstract base class for composer items with the ability to distribute the content to several frames (QgsComposerFrame items). More...

#include <qgscomposermultiframe.h>

Inheritance diagram for QgsComposerMultiFrame:
Inheritance graph
[legend]

Public Types

enum  ResizeMode { UseExistingFrames = 0, ExtendToNextPage, RepeatOnEveryPage, RepeatUntilFinished }
 
- Public Types inherited from QgsComposerObject
enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  MapRotation, MapScale, MapXMin, MapYMin,
  MapXMax, MapYMax, PictureSource, SourceUrl
}
 Data defined properties for different item types. More...
 
enum  PropertyValueType { EvaluatedValue = 0, OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...
 

Public Slots

void update ()
 Forces a redraw of all child frames. More...
 
virtual void recalculateFrameSizes ()
 Recalculates the portion of the multiframe item which is shown in each of it's component frames. More...
 
void recalculateFrameRects ()
 Forces a recalculation of all the associated frame's scene rectangles. More...
 
- Public Slots inherited from QgsComposerObject
virtual void repaint ()
 Triggers a redraw for the item. More...
 
virtual void refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. More...
 

Signals

void changed ()
 Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated. More...
 
void contentsChanged ()
 Emitted when the contents of the multi frame have changed and the frames must be redrawn. More...
 
- Signals inherited from QgsComposerObject
void itemChanged ()
 Emitted when the item changes. More...
 

Public Member Functions

 QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands)
 Construct a new multiframe item. More...
 
virtual ~QgsComposerMultiFrame ()
 
virtual QSizeF totalSize () const =0
 Returns the total size of the multiframe's content. More...
 
virtual QSizeF fixedFrameSize (const int frameIndex=-1) const
 Returns the fixed size for a frame, if desired. More...
 
virtual QSizeF minFrameSize (const int frameIndex=-1) const
 Returns the minimum size for a frames, if desired. More...
 
virtual Q_DECL_DEPRECATED void render (QPainter *p, const QRectF &renderExtent)
 Renders a portion of the multiframe's content into a painter. More...
 
virtual void render (QPainter *painter, const QRectF &renderExtent, const int frameIndex)
 Renders a portion of the multiframe's content into a painter. More...
 
virtual void addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)=0
 Adds a frame to the multiframe. More...
 
virtual double findNearbyPageBreak (double yPos)
 Finds the optimal position to break a frame at. More...
 
void removeFrame (int i)
 Removes a frame from the multiframe. More...
 
void deleteFrames ()
 Removes and deletes all child frames. More...
 
void setResizeMode (ResizeMode mode)
 Sets the resize mode for the multiframe, and recalculates frame sizes to match. More...
 
ResizeMode resizeMode () const
 Returns the resize mode for the multiframe. More...
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const =0
 Stores state information about multiframe in DOM element. More...
 
bool _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 Stores state information about base multiframe object in DOM element. More...
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)=0
 Reads multiframe state information from a DOM element. More...
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 Restores state information about base multiframe object from a DOM element. More...
 
QgsCompositioncomposition ()
 Returns the parent composition for the multiframe. More...
 
bool createUndoCommands () const
 Returns whether undo commands should be created for interactions with the multiframe. More...
 
void setCreateUndoCommands (bool enabled)
 Sets whether undo commands should be created for interactions with the multiframe. More...
 
int frameCount () const
 Returns the number of frames associated with this multiframe. More...
 
QgsComposerFrameframe (int i) const
 Returns a child frame from the multiframe. More...
 
int frameIndex (QgsComposerFrame *frame) const
 Returns the index of a frame within the multiframe. More...
 
QgsComposerFramecreateNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size)
 Creates a new frame and adds it to the multi frame and composition. More...
 
virtual QString displayName () const
 Get multiframe display name. More...
 
- Public Member Functions inherited from QgsComposerObject
 QgsComposerObject (QgsComposition *composition)
 Constructor. More...
 
virtual ~QgsComposerObject ()
 
const QgsCompositioncomposition () const
 Returns the composition the item is attached to. More...
 
QgsCompositioncomposition ()
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc) const
 Stores item state in DOM element. More...
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc)
 Sets item state from DOM element. More...
 
QgsDataDefineddataDefinedProperty (const DataDefinedProperty property) const
 Returns a reference to the data defined settings for one of the item's data defined properties. More...
 
void setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
 Sets parameters for a data defined property for the item. More...
 

Protected Slots

void handleFrameRemoval (QgsComposerItem *item)
 Called before a frame is going to be removed. More...
 
void handlePageChange ()
 Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. More...
 

Protected Attributes

QList< QgsComposerFrame * > mFrameItems
 
ResizeMode mResizeMode
 
bool mCreateUndoCommands
 True: creates QgsMultiFrameCommands on internal changes (e.g. More...
 
- Protected Attributes inherited from QgsComposerObject
QgsCompositionmComposition
 
QMap
< QgsComposerObject::DataDefinedProperty,
QString > 
mDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml. More...
 

Additional Inherited Members

- Protected Member Functions inherited from QgsComposerObject
bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue)
 Evaluate a data defined property and return the calculated value. More...
 

Detailed Description

Abstract base class for composer items with the ability to distribute the content to several frames (QgsComposerFrame items).

Member Enumeration Documentation

Specifies the behaviour for creating new frames to fit the multiframe's content

Enumerator
UseExistingFrames 

don't automatically create new frames, just use existing frames

ExtendToNextPage 

creates new full page frames on the following page(s) until the entire multiframe content is visible

RepeatOnEveryPage 

repeats the same frame on every page

RepeatUntilFinished 

creates new frames with the same position and dimensions as the existing frame on the following page(s), until the entire multiframe content is visible

Constructor & Destructor Documentation

QgsComposerMultiFrame::QgsComposerMultiFrame ( QgsComposition c,
bool  createUndoCommands 
)

Construct a new multiframe item.

Parameters
cparent composition
createUndoCommands
QgsComposerMultiFrame::~QgsComposerMultiFrame ( )
virtual

Member Function Documentation

bool QgsComposerMultiFrame::_readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)

Restores state information about base multiframe object from a DOM element.

Implementations of readXML should call this method.

Parameters
itemElemis DOM element
docis the DOM document
ignoreFramesset to false to avoid reading state information about child frames from DOM
See also
readXML
bool QgsComposerMultiFrame::_writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const

Stores state information about base multiframe object in DOM element.

Implementations of writeXML should call this method.

Parameters
elemis DOM element
docis the DOM document
ignoreFramesset to false to avoid writing state information about child frames into DOM
See also
writeXML
virtual void QgsComposerMultiFrame::addFrame ( QgsComposerFrame frame,
bool  recalcFrameSizes = true 
)
pure virtual

Adds a frame to the multiframe.

Parameters
frameframe to add
recalcFrameSizesset to true to force recalculation of all existing frame sizes
See also
removeFrame

Implemented in QgsComposerHtml, and QgsComposerAttributeTableV2.

void QgsComposerMultiFrame::changed ( )
signal

Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated.

QgsComposition* QgsComposerMultiFrame::composition ( )
inline

Returns the parent composition for the multiframe.

Returns
composition
void QgsComposerMultiFrame::contentsChanged ( )
signal

Emitted when the contents of the multi frame have changed and the frames must be redrawn.

QgsComposerFrame * QgsComposerMultiFrame::createNewFrame ( QgsComposerFrame currentFrame,
QPointF  pos,
QSizeF  size 
)

Creates a new frame and adds it to the multi frame and composition.

Parameters
currentFramean existing QgsComposerFrame from which to copy the size and general frame properties (eg frame style, background, rendering settings).
posposition of top-left corner of the new frame
sizesize of the new frame
Returns
new QgsComposerFrame
Note
added in version 2.3
bool QgsComposerMultiFrame::createUndoCommands ( ) const
inline

Returns whether undo commands should be created for interactions with the multiframe.

Returns
true if undo commands should be created
See also
setCreateUndoCommands
void QgsComposerMultiFrame::deleteFrames ( )

Removes and deletes all child frames.

See also
removeFrame
QString QgsComposerMultiFrame::displayName ( ) const
virtual

Get multiframe display name.

Returns
display name for item
Note
added in version 2.5

Reimplemented in QgsComposerHtml.

virtual double QgsComposerMultiFrame::findNearbyPageBreak ( double  yPos)
inlinevirtual

Finds the optimal position to break a frame at.

Parameters
yPosmaximum vertical position for break
Returns
the optimal breakable position which occurs in the multi frame close to and before the specified yPos
Note
added in version 2.3

Reimplemented in QgsComposerHtml.

virtual QSizeF QgsComposerMultiFrame::fixedFrameSize ( const int  frameIndex = -1) const
inlinevirtual

Returns the fixed size for a frame, if desired.

If the fixed frame size changes, the sizes of all frames can be recalculated by calling recalculateFrameRects().

Parameters
frameIndexframe number
Returns
fixed size for frame. If the size has a width or height of 0, then the frame size is not fixed in that direction and frames can have variable width or height accordingly.
Note
added in version 2.5
See also
minFrameSize
recalculateFrameRects

Reimplemented in QgsComposerTableV2.

QgsComposerFrame * QgsComposerMultiFrame::frame ( int  i) const

Returns a child frame from the multiframe.

Parameters
iindex of frame
Returns
child frame if found
See also
frameIndex
int QgsComposerMultiFrame::frameCount ( ) const
inline

Returns the number of frames associated with this multiframe.

Returns
number of child frames
Note
added in QGIS 2.0, replaces nFrames
int QgsComposerMultiFrame::frameIndex ( QgsComposerFrame frame) const

Returns the index of a frame within the multiframe.

Parameters
frameframe to find index of
Returns
index for frame if found, -1 if frame not found in multiframe
Note
added in version 2.5
See also
frame
void QgsComposerMultiFrame::handleFrameRemoval ( QgsComposerItem item)
protectedslot

Called before a frame is going to be removed.

Updates frame list and recalculates content of remaining frames.

void QgsComposerMultiFrame::handlePageChange ( )
protectedslot

Adapts to changed number of composition pages if resize type is RepeatOnEveryPage.

virtual QSizeF QgsComposerMultiFrame::minFrameSize ( const int  frameIndex = -1) const
inlinevirtual

Returns the minimum size for a frames, if desired.

If the minimum size changes, the sizes of all frames can be recalculated by calling recalculateFrameRects().

Parameters
frameIndexframe number
Returns
minimum size for frame. If the size has a width or height of 0, then the frame size has no minimum in that direction.
Note
added in version 2.5
See also
fixedFrameSize
recalculateFrameRects

Reimplemented in QgsComposerTableV2.

virtual bool QgsComposerMultiFrame::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
pure virtual

Reads multiframe state information from a DOM element.

Implementations of readXML should also call the _readXML method to restore general multiframe properties.

Parameters
itemElemis DOM element
docis the DOM document
ignoreFramesset to false to avoid read state information about child frames from DOM
See also
_readXML

Implemented in QgsComposerTableV2, QgsComposerHtml, and QgsComposerAttributeTableV2.

void QgsComposerMultiFrame::recalculateFrameRects ( )
slot

Forces a recalculation of all the associated frame's scene rectangles.

This method is useful for multiframes which implement a minFrameSize() or fixedFrameSize() method.

Note
added in version 2.5
See also
minFrameSize()
fixedFrameSize()
recalculateFrameSizes
void QgsComposerMultiFrame::recalculateFrameSizes ( )
virtualslot

Recalculates the portion of the multiframe item which is shown in each of it's component frames.

If the resize mode is set to anything but UseExistingFrames then 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.

See also
recalculateFrameRects
void QgsComposerMultiFrame::removeFrame ( int  i)

Removes a frame from the multiframe.

This method automatically removes the frame from the composition.

Parameters
iindex of frame to remove
See also
addFrame
deleteFrames
void QgsComposerMultiFrame::render ( QPainter *  p,
const QRectF &  renderExtent 
)
virtual

Renders a portion of the multiframe's content into a painter.

Parameters
pdestination painter
renderExtentvisible extent of content to render into the painter.
Deprecated:
use render( QPainter* painter, const QRectF& renderExtent, const int frameIndex ) instead
void QgsComposerMultiFrame::render ( QPainter *  painter,
const QRectF &  renderExtent,
const int  frameIndex 
)
virtual

Renders a portion of the multiframe's content into a painter.

Parameters
painterdestination painter
renderExtentvisible extent of content to render into the painter.
frameIndexframe number for content
Note
added in version 2.5

Reimplemented in QgsComposerTableV2, and QgsComposerHtml.

ResizeMode QgsComposerMultiFrame::resizeMode ( ) const
inline

Returns the resize mode for the multiframe.

Returns
resize mode
See also
setResizeMode
void QgsComposerMultiFrame::setCreateUndoCommands ( bool  enabled)
inline

Sets whether undo commands should be created for interactions with the multiframe.

Parameters
enabledset to true if undo commands should be created
See also
createUndoCommands
void QgsComposerMultiFrame::setResizeMode ( ResizeMode  mode)

Sets the resize mode for the multiframe, and recalculates frame sizes to match.

Parameters
moderesize mode
See also
resizeMode
virtual QSizeF QgsComposerMultiFrame::totalSize ( ) const
pure virtual

Returns the total size of the multiframe's content.

Returns
total size required for content

Implemented in QgsComposerTableV2, and QgsComposerHtml.

void QgsComposerMultiFrame::update ( )
slot

Forces a redraw of all child frames.

virtual bool QgsComposerMultiFrame::writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const
pure virtual

Stores state information about multiframe in DOM element.

Implementations of writeXML should also call the _writeXML method to save general multiframe properties.

Parameters
elemis DOM element
docis the DOM document
ignoreFramesset to false to avoid writing state information about child frames into DOM
See also
_writeXML

Implemented in QgsComposerTableV2, QgsComposerHtml, and QgsComposerAttributeTableV2.

Member Data Documentation

bool QgsComposerMultiFrame::mCreateUndoCommands
protected

True: creates QgsMultiFrameCommands on internal changes (e.g.

changing frames )

QList<QgsComposerFrame*> QgsComposerMultiFrame::mFrameItems
protected
ResizeMode QgsComposerMultiFrame::mResizeMode
protected

The documentation for this class was generated from the following files: