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

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

#include <qgscomposermultiframe.h>

Inheritance diagram for QgsComposerMultiFrame:
Inheritance graph
[legend]
Collaboration diagram for QgsComposerMultiFrame:
Collaboration 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 recalculateFrameSizes ()
 Recalculates the portion of the multiframe item which is shown in each of it's component frames. 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 ()
 
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)
 
virtual ~QgsComposerMultiFrame ()
 
virtual QSizeF totalSize () const =0
 
virtual void render (QPainter *p, const QRectF &renderExtent)=0
 
virtual void addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)=0
 
virtual double findNearbyPageBreak (double yPos)
 Finds the optimal position to break a frame at. More...
 
void removeFrame (int i)
 
void update ()
 
void setResizeMode (ResizeMode mode)
 
ResizeMode resizeMode () const
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const =0
 
bool _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)=0
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 
QgsCompositioncomposition ()
 
bool createUndoCommands () const
 
void setCreateUndoCommands (bool enabled)
 
void deleteFrames ()
 Removes and deletes all frames from mComposition. More...
 
int frameCount () const
 Return the number of frames associated with this multiframeset. More...
 
QgsComposerFrameframe (int i) const
 
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 (update frame list) More...
 
void handlePageChange ()
 Adapts to changed number of 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...
 

Private Member Functions

 QgsComposerMultiFrame ()
 

Private Attributes

bool mIsRecalculatingSize
 

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 entries with the ability to distribute the content to several frames (items)

Definition at line 33 of file qgscomposermultiframe.h.

Member Enumeration Documentation

Enumerator
UseExistingFrames 
ExtendToNextPage 
RepeatOnEveryPage 
RepeatUntilFinished 

Definition at line 38 of file qgscomposermultiframe.h.

Constructor & Destructor Documentation

QgsComposerMultiFrame::QgsComposerMultiFrame ( QgsComposition c,
bool  createUndoCommands 
)
QgsComposerMultiFrame::~QgsComposerMultiFrame ( )
virtual

Definition at line 38 of file qgscomposermultiframe.cpp.

References deleteFrames().

QgsComposerMultiFrame::QgsComposerMultiFrame ( )
private

Definition at line 31 of file qgscomposermultiframe.cpp.

Member Function Documentation

bool QgsComposerMultiFrame::_readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
bool QgsComposerMultiFrame::_writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const
virtual void QgsComposerMultiFrame::addFrame ( QgsComposerFrame frame,
bool  recalcFrameSizes = true 
)
pure virtual

Implemented in QgsComposerHtml.

Referenced by _readXML(), createNewFrame(), and handlePageChange().

void QgsComposerMultiFrame::changed ( )
signal
QgsComposition* QgsComposerMultiFrame::composition ( )
inline

Definition at line 73 of file qgscomposermultiframe.h.

References QgsComposerObject::mComposition.

void QgsComposerMultiFrame::contentsChanged ( )
signal

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

Referenced by QgsComposerHtml::loadHtml().

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

Definition at line 163 of file qgscomposermultiframe.cpp.

References addFrame(), QgsComposerItem::backgroundColor(), QgsComposerItem::blendMode(), QgsComposerItem::frameJoinStyle(), QgsComposerItem::frameOutlineWidth(), QgsComposerItem::hasBackground(), QgsComposerItem::hasFrame(), QgsComposerObject::mComposition, QgsComposerItem::setBackgroundColor(), QgsComposerItem::setBackgroundEnabled(), QgsComposerItem::setBlendMode(), QgsComposerItem::setFrameEnabled(), QgsComposerItem::setFrameJoinStyle(), and QgsComposerItem::setFrameOutlineWidth().

Referenced by recalculateFrameSizes().

bool QgsComposerMultiFrame::createUndoCommands ( ) const
inline

Definition at line 75 of file qgscomposermultiframe.h.

void QgsComposerMultiFrame::deleteFrames ( )
QString QgsComposerMultiFrame::displayName ( ) const
virtual

Get multiframe display name.

Returns
display name for item
Note
added in version 2.5

Reimplemented in QgsComposerHtml.

Definition at line 187 of file qgscomposermultiframe.cpp.

References tr.

Referenced by QgsComposerFrame::displayName().

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.

Definition at line 58 of file qgscomposermultiframe.h.

Referenced by recalculateFrameSizes().

QgsComposerFrame * QgsComposerMultiFrame::frame ( int  i) const

Definition at line 301 of file qgscomposermultiframe.cpp.

References mFrameItems.

Referenced by handleFrameRemoval(), and handlePageChange().

int QgsComposerMultiFrame::frameCount ( ) const
inline

Return the number of frames associated with this multiframeset.

Note
added in 2.0, replaces nFrames

Definition at line 84 of file qgscomposermultiframe.h.

Referenced by QgsComposerHtml::loadHtml(), and QgsComposition::removeComposerItem().

void QgsComposerMultiFrame::handleFrameRemoval ( QgsComposerItem item)
protectedslot

Called before a frame is going to be removed (update frame list)

Definition at line 192 of file qgscomposermultiframe.cpp.

References changed(), frame(), index, mFrameItems, mIsRecalculatingSize, mResizeMode, recalculateFrameSizes(), RepeatOnEveryPage, resizeMode(), and UseExistingFrames.

Referenced by deleteFrames(), and QgsComposerHtml::QgsComposerHtml().

void QgsComposerMultiFrame::handlePageChange ( )
protectedslot
virtual bool QgsComposerMultiFrame::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
pure virtual
void QgsComposerMultiFrame::recalculateFrameSizes ( )
slot

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.

Definition at line 53 of file qgscomposermultiframe.cpp.

References createNewFrame(), ExtendToNextPage, findNearbyPageBreak(), QgsComposerObject::mComposition, mFrameItems, mResizeMode, QgsComposition::numPages(), QgsComposition::paperHeight(), removeFrame(), RepeatOnEveryPage, RepeatUntilFinished, QgsComposerFrame::setContentSection(), QgsComposition::setNumPages(), size, QgsComposition::spaceBetweenPages(), totalSize(), and UseExistingFrames.

Referenced by QgsComposerHtml::addFrame(), handleFrameRemoval(), handlePageChange(), QgsComposerHtml::loadHtml(), QgsComposerHtml::setMaxBreakDistance(), setResizeMode(), and QgsComposerHtml::setUseSmartBreaks().

void QgsComposerMultiFrame::removeFrame ( int  i)
virtual void QgsComposerMultiFrame::render ( QPainter *  p,
const QRectF &  renderExtent 
)
pure virtual

Implemented in QgsComposerHtml.

Referenced by QgsComposerFrame::paint().

ResizeMode QgsComposerMultiFrame::resizeMode ( ) const
inline

Definition at line 65 of file qgscomposermultiframe.h.

Referenced by handleFrameRemoval().

void QgsComposerMultiFrame::setCreateUndoCommands ( bool  enabled)
inline

Definition at line 76 of file qgscomposermultiframe.h.

Referenced by QgsComposition::addItemsFromXML().

void QgsComposerMultiFrame::setResizeMode ( ResizeMode  mode)

Definition at line 43 of file qgscomposermultiframe.cpp.

References changed(), mResizeMode, and recalculateFrameSizes().

virtual QSizeF QgsComposerMultiFrame::totalSize ( ) const
pure virtual

Implemented in QgsComposerHtml.

Referenced by recalculateFrameSizes().

void QgsComposerMultiFrame::update ( )

Definition at line 276 of file qgscomposermultiframe.cpp.

References mFrameItems.

Referenced by handlePageChange().

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

Member Data Documentation

bool QgsComposerMultiFrame::mCreateUndoCommands
protected

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

changing frames )

Definition at line 116 of file qgscomposermultiframe.h.

QList<QgsComposerFrame*> QgsComposerMultiFrame::mFrameItems
protected
bool QgsComposerMultiFrame::mIsRecalculatingSize
private

Definition at line 127 of file qgscomposermultiframe.h.

Referenced by handleFrameRemoval(), and removeFrame().

ResizeMode QgsComposerMultiFrame::mResizeMode
protected

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