QGIS API Documentation
2.6.0-Brighton
|
Graphics scene for map printing. More...
#include <qgscomposition.h>
Public Types | |
enum | PlotStyle { Preview = 0, Print, Postscript } |
Plot type. More... | |
enum | GridStyle { Solid, Dots, Crosses } |
Style to draw the snapping grid. More... | |
enum | ZValueDirection { ZValueBelow, ZValueAbove } |
enum | PaperOrientation { Portrait, Landscape } |
enum | AtlasMode { AtlasOff, PreviewAtlas, ExportAtlas } |
Composition atlas modes. More... |
Public Slots | |
void | sendItemAddedSignal (QgsComposerItem *item) |
Casts object to the proper subclass type and calls corresponding itemAdded signal. | |
void | updateBounds () |
Updates the scene bounds of the composition. | |
void | refreshItems () |
Forces items in the composition to refresh. | |
void | setSelectedItem (QgsComposerItem *item) |
Clears any selected items and sets an item as the current selection. | |
void | setAllUnselected () |
Clears any selected items in the composition. | |
void | refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) |
Refreshes a data defined property for the composition by reevaluating the property's value and redrawing the composition with this new value. |
Signals | |
void | paperSizeChanged () |
void | nPagesChanged () |
void | printResolutionChanged () |
Is emitted when the compositions print resolution changes. | |
void | selectedItemChanged (QgsComposerItem *selected) |
Is emitted when selected item changed. | |
void | composerArrowAdded (QgsComposerArrow *arrow) |
Is emitted when new composer arrow has been added to the view. | |
void | composerHtmlFrameAdded (QgsComposerHtml *html, QgsComposerFrame *frame) |
Is emitted when a new composer html has been added to the view. | |
void | composerLabelAdded (QgsComposerLabel *label) |
Is emitted when new composer label has been added to the view. | |
void | composerMapAdded (QgsComposerMap *map) |
Is emitted when new composer map has been added to the view. | |
void | composerScaleBarAdded (QgsComposerScaleBar *scalebar) |
Is emitted when new composer scale bar has been added. | |
void | composerLegendAdded (QgsComposerLegend *legend) |
Is emitted when a new composer legend has been added. | |
void | composerPictureAdded (QgsComposerPicture *picture) |
Is emitted when a new composer picture has been added. | |
void | composerShapeAdded (QgsComposerShape *shape) |
Is emitted when a new composer shape has been added. | |
void | composerTableAdded (QgsComposerAttributeTable *table) |
Is emitted when a new composer table has been added. | |
void | composerTableFrameAdded (QgsComposerAttributeTableV2 *table, QgsComposerFrame *frame) |
Is emitted when a new composer table frame has been added to the view. | |
void | itemRemoved (QgsComposerItem *) |
Is emitted when a composer item has been removed from the scene. | |
void | refreshItemsTriggered () |
Is emitted when item in the composition must be refreshed. | |
void | statusMsgChanged (QString message) |
Is emitted when the composition has an updated status bar message for the composer window. |
Public Member Functions | |
Q_DECL_DEPRECATED | QgsComposition (QgsMapRenderer *mapRenderer) |
QgsComposition (const QgsMapSettings &mapSettings) | |
~QgsComposition () | |
void | setPaperSize (const double width, const double height) |
Changes size of paper item. | |
double | paperHeight () const |
Height of paper item. | |
double | paperWidth () const |
Width of paper item. | |
double | spaceBetweenPages () const |
Returns the vertical space between pages in a composer view. | |
void | setNumPages (const int pages) |
Sets the number of pages for the composition. | |
int | numPages () const |
Returns the number of pages in the composition. | |
bool | pageIsEmpty (const int page) const |
Returns whether a page is empty, ie, it contains no items except for the background paper item. | |
bool | shouldExportPage (const int page) const |
Returns whether a specified page number should be included in exports of the composition. | |
void | setPageStyleSymbol (QgsFillSymbolV2 *symbol) |
Note: added in version 2.1. | |
QgsFillSymbolV2 * | pageStyleSymbol () |
Note: added in version 2.1. | |
QPointF | positionOnPage (const QPointF &position) const |
Returns the position within a page of a point in the composition. | |
int | pageNumberForPoint (const QPointF &position) const |
Returns the page number corresponding to a point in the composition. | |
void | setStatusMessage (const QString &message) |
Sets the status bar message for the composer window. | |
void | updateSettings () |
Refreshes the composition when composer related options change. | |
void | setSnapToGridEnabled (const bool b) |
bool | snapToGridEnabled () const |
void | setGridVisible (const bool b) |
bool | gridVisible () const |
void | setSnapLinesVisible (const bool visible) |
Hides / shows custom snap lines. | |
bool | snapLinesVisible () const |
void | setAlignmentSnap (const bool s) |
bool | alignmentSnap () const |
void | setSmartGuidesEnabled (const bool b) |
bool | smartGuidesEnabled () const |
void | clearSnapLines () |
Removes all snap lines. | |
void | setSnapGridResolution (const double r) |
double | snapGridResolution () const |
void | setSnapGridOffsetX (const double offset) |
double | snapGridOffsetX () const |
void | setSnapGridOffsetY (const double offset) |
double | snapGridOffsetY () const |
void | setGridPen (const QPen &p) |
const QPen & | gridPen () const |
void | setGridStyle (const GridStyle s) |
GridStyle | gridStyle () const |
Q_DECL_DEPRECATED void | setSnapGridTolerance (double tolerance) |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid. | |
Q_DECL_DEPRECATED double | snapGridTolerance () const |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid. | |
Q_DECL_DEPRECATED void | setAlignmentSnapTolerance (double t) |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items. | |
Q_DECL_DEPRECATED double | alignmentSnapTolerance () const |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items. | |
void | setSnapTolerance (const int snapTolerance) |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items. | |
int | snapTolerance () const |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items. | |
QUndoStack * | undoStack () |
Returns pointer to undo/redo command storage. | |
QgsComposerItem * | composerItemAt (const QPointF &position, const bool ignoreLocked=false) const |
Returns the topmost composer item at a specified position. | |
QgsComposerItem * | composerItemAt (const QPointF &position, const QgsComposerItem *belowItem, const bool ignoreLocked=false) const |
Returns the topmost composer item at a specified position which is below a specified item. | |
int | pageNumberAt (const QPointF &position) const |
Returns the page number (0-based) given a coordinate. | |
int | itemPageNumber (const QgsComposerItem *) const |
Returns on which page number (0-based) is displayed an item. | |
QList< QgsComposerItem * > | selectedComposerItems (const bool includeLockedItems=true) |
Returns list of selected composer items. | |
QList< const QgsComposerMap * > | composerMapItems () const |
Returns pointers to all composer maps in the scene. | |
template<class T > | |
void | composerItems (QList< T * > &itemList) |
Return composer items of a specific type. | |
template<class T > | |
void | composerItemsOnPage (QList< T * > &itemList, const int pageNumber) const |
Return composer items of a specific type on a specified page. | |
const QgsComposerMap * | getComposerMapById (const int id) const |
Returns the composer map with specified id. | |
Q_DECL_DEPRECATED const QgsComposerHtml * | getComposerHtmlByItem (QgsComposerItem *item) const |
Returns the composer html with specified id (a string as named in the composer user interface item properties). | |
const QgsComposerItem * | getComposerItemById (const QString theId) const |
Returns a composer item given its text identifier. | |
const QgsComposerItem * | getComposerItemByUuid (const QString theUuid) const |
Returns a composer item given its unique identifier. | |
int | printResolution () const |
void | setPrintResolution (const int dpi) |
bool | printAsRaster () const |
void | setPrintAsRaster (const bool enabled) |
bool | generateWorldFile () const |
void | setGenerateWorldFile (const bool enabled) |
QgsComposerMap * | worldFileMap () const |
void | setWorldFileMap (QgsComposerMap *map) |
bool | useAdvancedEffects () const |
Returns true if a composition should use advanced effects such as blend modes. | |
void | setUseAdvancedEffects (const bool effectsEnabled) |
Used to enable or disable advanced effects such as blend modes in a composition. | |
Q_DECL_DEPRECATED QgsMapRenderer * | mapRenderer () |
Returns pointer to map renderer of qgis map canvas. | |
const QgsMapSettings & | mapSettings () const |
Return setting of QGIS map canvas. | |
QgsComposition::PlotStyle | plotStyle () const |
void | setPlotStyle (const QgsComposition::PlotStyle style) |
Q_DECL_DEPRECATED int | pixelFontSize (double pointSize) const |
Returns the mm font size for a font that has point size set. | |
Q_DECL_DEPRECATED double | pointFontSize (int pixelSize) const |
Does the inverse calculation and returns points for mm. | |
bool | writeXML (QDomElement &composerElem, QDomDocument &doc) |
Writes settings to xml (paper dimension) | |
bool | readXML (const QDomElement &compositionElem, const QDomDocument &doc) |
Reads settings from xml file. | |
bool | loadFromTemplate (const QDomDocument &doc, QMap< QString, QString > *substitutionMap=0, bool addUndoCommands=false, const bool clearComposition=true) |
Load a template document. | |
void | addItemsFromXML (const QDomElement &elem, const QDomDocument &doc, QMap< QgsComposerMap *, int > *mapsToRestore=0, bool addUndoCommands=false, QPointF *pos=0, bool pasteInPlace=false) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) | |
void | addItemToZList (QgsComposerItem *item) |
Adds item to z list. | |
void | removeItemFromZList (QgsComposerItem *item) |
Removes item from z list. | |
void | raiseSelectedItems () |
bool | raiseItem (QgsComposerItem *item) |
void | lowerSelectedItems () |
bool | lowerItem (QgsComposerItem *item) |
void | moveSelectedItemsToTop () |
bool | moveItemToTop (QgsComposerItem *item) |
void | moveSelectedItemsToBottom () |
bool | moveItemToBottom (QgsComposerItem *item) |
void | selectNextByZOrder (const ZValueDirection direction) |
QgsComposerItem * | getComposerItemBelow (QgsComposerItem *item) const |
QgsComposerItem * | getComposerItemAbove (QgsComposerItem *item) const |
void | alignSelectedItemsLeft () |
void | alignSelectedItemsHCenter () |
void | alignSelectedItemsRight () |
void | alignSelectedItemsTop () |
void | alignSelectedItemsVCenter () |
void | alignSelectedItemsBottom () |
void | lockSelectedItems () |
Lock the selected items. | |
void | unlockAllItems () |
Unlock all items. | |
QgsComposerItemGroup * | groupItems (QList< QgsComposerItem * > items) |
Creates a new group from a list of composer items and adds it to the composition. | |
QList< QgsComposerItem * > | ungroupItems (QgsComposerItemGroup *group) |
Ungroups items by removing them from an item group and removing the group from the composition. | |
Q_DECL_DEPRECATED void | sortZList () |
Sorts the zList. | |
void | refreshZList () |
Rebuilds the z order list by adding any item which are present in the composition but missing from the z order list. | |
QPointF | snapPointToGrid (const QPointF &scenePoint) const |
Snaps a scene coordinate point to grid. | |
QList< QGraphicsLineItem * > * | snapLines () |
Returns pointer to snap lines collection. | |
QgsComposerMouseHandles * | selectionHandles () |
Returns pointer to selection handles. | |
QGraphicsLineItem * | addSnapLine () |
Add a custom snap line (can be horizontal or vertical) | |
void | removeSnapLine (QGraphicsLineItem *line) |
Remove custom snap line (and delete the object) | |
QGraphicsLineItem * | nearestSnapLine (const bool horizontal, const double x, const double y, const double tolerance, QList< QPair< QgsComposerItem *, QgsComposerItem::ItemPositionMode > > &snappedItems) const |
Get nearest snap line. | |
void | beginCommand (QgsComposerItem *item, const QString &commandText, const QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown) |
Allocates new item command and saves initial state in it. | |
void | endCommand () |
Saves end state of item and pushes command to the undo history. | |
void | cancelCommand () |
Deletes current command. | |
void | beginMultiFrameCommand (QgsComposerMultiFrame *multiFrame, const QString &text, const QgsComposerMultiFrameMergeCommand::Context c=QgsComposerMultiFrameMergeCommand::Unknown) |
void | endMultiFrameCommand () |
void | cancelMultiFrameCommand () |
Deletes current multi frame command. | |
void | addMultiFrame (QgsComposerMultiFrame *multiFrame) |
Adds multiframe. | |
void | removeMultiFrame (QgsComposerMultiFrame *multiFrame) |
Removes multi frame (but does not delete it) | |
void | addComposerArrow (QgsComposerArrow *arrow) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerLabel (QgsComposerLabel *label) |
Adds label to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerMap (QgsComposerMap *map, const bool setDefaultPreviewStyle=true) |
Adds map to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerScaleBar (QgsComposerScaleBar *scaleBar) |
Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerLegend (QgsComposerLegend *legend) |
Adds legend to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerPicture (QgsComposerPicture *picture) |
Adds picture to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerShape (QgsComposerShape *shape) |
Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerTable (QgsComposerAttributeTable *table) |
Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal) | |
void | addComposerHtmlFrame (QgsComposerHtml *html, QgsComposerFrame *frame) |
Adds composer html frame and advises composer to create a widget for it (through signal) | |
void | addComposerTableFrame (QgsComposerAttributeTableV2 *table, QgsComposerFrame *frame) |
Adds composer tablev2 frame and advises composer to create a widget for it (through signal) | |
void | removeComposerItem (QgsComposerItem *item, const bool createCommand=true, const bool removeGroupItems=true) |
Remove item from the graphics scene. | |
void | pushAddRemoveCommand (QgsComposerItem *item, const QString &text, const QgsAddRemoveItemCommand::State state=QgsAddRemoveItemCommand::Added) |
Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack. | |
void | setPreventCursorChange (const bool preventChange) |
If true, prevents any mouse cursor changes by the composition or by any composer items Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes. | |
bool | preventCursorChange () const |
void | beginPrint (QPrinter &printer, const bool evaluateDDPageSize=false) |
Prepare the printer for printing. | |
void | beginPrintAsPDF (QPrinter &printer, const QString &file) |
Prepare the printer for printing in a PDF. | |
void | doPrint (QPrinter &printer, QPainter &painter, bool startNewPage=false) |
Print on a preconfigured printer. | |
bool | print (QPrinter &printer, const bool evaluateDDPageSize=false) |
Convenience function that prepares the printer and prints. | |
bool | exportAsPDF (const QString &file) |
Convenience function that prepares the printer for printing in PDF and prints. | |
QImage | printPageAsRaster (int page) |
print composer page to image If the image does not fit into memory, a null image is returned | |
void | renderPage (QPainter *p, int page) |
Render a page to a paint device. | |
void | computeWorldFileParameters (double &a, double &b, double &c, double &d, double &e, double &f) const |
Compute world file parameters. | |
QgsAtlasComposition & | atlasComposition () |
QgsComposition::AtlasMode | atlasMode () const |
Returns the current atlas mode of the composition. | |
bool | setAtlasMode (const QgsComposition::AtlasMode mode) |
Sets the current atlas mode of the composition. | |
QList< QgsPaperItem * > | pages () |
Return pages in the correct order. | |
QgsDataDefined * | dataDefinedProperty (const QgsComposerObject::DataDefinedProperty property) |
Returns a reference to the data defined settings for one of the composition's data defined properties. | |
void | setDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property, bool active, bool useExpression, const QString &expression, const QString &field) |
Sets parameters for a data defined property for the composition. | |
QgsComposerModel * | itemsModel () |
Returns the items model attached to the composition. |
Static Public Member Functions | |
static Q_DECL_DEPRECATED void | relativeResizeRect (QRectF &rectToResize, const QRectF &boundsBefore, const QRectF &boundsAfter) |
Resizes a QRectF relative to the change from boundsBefore to boundsAfter. | |
static Q_DECL_DEPRECATED double | relativePosition (double position, double beforeMin, double beforeMax, double afterMin, double afterMax) |
Returns a scaled position given a before and after range. |
Protected Member Functions | |
void | init () |
Friends | |
class | QgsComposerObject |
class | QgsComposerModel |
Graphics scene for map printing.
The class manages the paper item which always is the item in the back (z-value 0). It maintains the z-Values of the items and stores them in a list in ascending z-Order. This list can be changed to lower/raise items one position or to bring them to front/back.
QgsComposition::QgsComposition | ( | QgsMapRenderer * | mapRenderer | ) |
|
explicit |
QgsComposition::~QgsComposition | ( | ) |
void QgsComposition::addComposerArrow | ( | QgsComposerArrow * | arrow | ) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerHtmlFrame | ( | QgsComposerHtml * | html, |
QgsComposerFrame * | frame | ||
) |
Adds composer html frame and advises composer to create a widget for it (through signal)
void QgsComposition::addComposerLabel | ( | QgsComposerLabel * | label | ) |
Adds label to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerLegend | ( | QgsComposerLegend * | legend | ) |
Adds legend to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerMap | ( | QgsComposerMap * | map, |
const bool | setDefaultPreviewStyle = true |
||
) |
Adds map to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerPicture | ( | QgsComposerPicture * | picture | ) |
Adds picture to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerScaleBar | ( | QgsComposerScaleBar * | scaleBar | ) |
Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerShape | ( | QgsComposerShape * | shape | ) |
Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerTable | ( | QgsComposerAttributeTable * | table | ) |
Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)
void QgsComposition::addComposerTableFrame | ( | QgsComposerAttributeTableV2 * | table, |
QgsComposerFrame * | frame | ||
) |
Adds composer tablev2 frame and advises composer to create a widget for it (through signal)
void QgsComposition::addItemsFromXML | ( | const QDomElement & | elem, |
const QDomDocument & | doc, | ||
QMap< QgsComposerMap *, int > * | mapsToRestore = 0 , |
||
bool | addUndoCommands = false , |
||
QPointF * | pos = 0 , |
||
bool | pasteInPlace = false |
||
) |
Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard)
elem | items parent element, e.g. <Composer>or <ComposerItemClipboard> |
doc | xml document |
mapsToRestore | for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand |
addUndoCommands | insert AddItem commands if true (e.g. for copy/paste) |
pos | item position. Optional, take position from xml if 0 |
pasteInPlace | whether the position should be kept but mapped to the page origin. (the page is the page under to the mouse cursor) |
void QgsComposition::addItemToZList | ( | QgsComposerItem * | item | ) |
Adds item to z list.
Usually called from constructor of QgsComposerItem
void QgsComposition::addMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Adds multiframe.
The object is owned by QgsComposition until removeMultiFrame is called
QGraphicsLineItem * QgsComposition::addSnapLine | ( | ) |
Add a custom snap line (can be horizontal or vertical)
|
inline |
|
inline |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items.
void QgsComposition::alignSelectedItemsBottom | ( | ) |
void QgsComposition::alignSelectedItemsHCenter | ( | ) |
void QgsComposition::alignSelectedItemsLeft | ( | ) |
void QgsComposition::alignSelectedItemsRight | ( | ) |
void QgsComposition::alignSelectedItemsTop | ( | ) |
void QgsComposition::alignSelectedItemsVCenter | ( | ) |
|
inline |
|
inline |
void QgsComposition::beginCommand | ( | QgsComposerItem * | item, |
const QString & | commandText, | ||
const QgsComposerMergeCommand::Context | c = QgsComposerMergeCommand::Unknown |
||
) |
Allocates new item command and saves initial state in it.
item | target item |
commandText | descriptive command text |
c | context for merge commands (unknown for non-mergeable commands) |
void QgsComposition::beginMultiFrameCommand | ( | QgsComposerMultiFrame * | multiFrame, |
const QString & | text, | ||
const QgsComposerMultiFrameMergeCommand::Context | c = QgsComposerMultiFrameMergeCommand::Unknown |
||
) |
void QgsComposition::beginPrint | ( | QPrinter & | printer, |
const bool | evaluateDDPageSize = false |
||
) |
Prepare the printer for printing.
void QgsComposition::beginPrintAsPDF | ( | QPrinter & | printer, |
const QString & | file | ||
) |
Prepare the printer for printing in a PDF.
void QgsComposition::cancelCommand | ( | ) |
Deletes current command.
void QgsComposition::cancelMultiFrameCommand | ( | ) |
Deletes current multi frame command.
void QgsComposition::clearSnapLines | ( | ) |
Removes all snap lines.
|
signal |
Is emitted when new composer arrow has been added to the view.
|
signal |
Is emitted when a new composer html has been added to the view.
QgsComposerItem * QgsComposition::composerItemAt | ( | const QPointF & | position, |
const bool | ignoreLocked = false |
||
) | const |
Returns the topmost composer item at a specified position.
Ignores paper items.
position | point to search for item at |
ignoreLocked | set to true to ignore locked items |
QgsComposerItem * QgsComposition::composerItemAt | ( | const QPointF & | position, |
const QgsComposerItem * | belowItem, | ||
const bool | ignoreLocked = false |
||
) | const |
Returns the topmost composer item at a specified position which is below a specified item.
Ignores paper items.
position | point to search for item at |
belowItem | item to search below |
ignoreLocked | set to true to ignore locked items |
void QgsComposition::composerItems | ( | QList< T * > & | itemList | ) |
Return composer items of a specific type.
itemList | list of item type to store matching items in |
void QgsComposition::composerItemsOnPage | ( | QList< T * > & | itemList, |
const int | pageNumber | ||
) | const |
Return composer items of a specific type on a specified page.
itemList | list of item type to store matching items in |
pageNumber | page number (0 based) |
|
signal |
Is emitted when new composer label has been added to the view.
|
signal |
Is emitted when a new composer legend has been added.
|
signal |
Is emitted when new composer map has been added to the view.
QList< const QgsComposerMap * > QgsComposition::composerMapItems | ( | ) | const |
Returns pointers to all composer maps in the scene.
|
signal |
Is emitted when a new composer picture has been added.
|
signal |
Is emitted when new composer scale bar has been added.
|
signal |
Is emitted when a new composer shape has been added.
|
signal |
Is emitted when a new composer table has been added.
|
signal |
Is emitted when a new composer table frame has been added to the view.
void QgsComposition::computeWorldFileParameters | ( | double & | a, |
double & | b, | ||
double & | c, | ||
double & | d, | ||
double & | e, | ||
double & | f | ||
) | const |
Compute world file parameters.
QgsDataDefined * QgsComposition::dataDefinedProperty | ( | const QgsComposerObject::DataDefinedProperty | property | ) |
Returns a reference to the data defined settings for one of the composition's data defined properties.
property | data defined property to return |
void QgsComposition::doPrint | ( | QPrinter & | printer, |
QPainter & | painter, | ||
bool | startNewPage = false |
||
) |
Print on a preconfigured printer.
printer | QPrinter destination |
painter | QPainter source |
startNewPage | set to true to begin the print on a new page |
void QgsComposition::endCommand | ( | ) |
Saves end state of item and pushes command to the undo history.
void QgsComposition::endMultiFrameCommand | ( | ) |
bool QgsComposition::exportAsPDF | ( | const QString & | file | ) |
Convenience function that prepares the printer for printing in PDF and prints.
|
inline |
const QgsComposerHtml * QgsComposition::getComposerHtmlByItem | ( | QgsComposerItem * | item | ) | const |
Returns the composer html with specified id (a string as named in the composer user interface item properties).
item | the item. |
QgsComposerItem * QgsComposition::getComposerItemAbove | ( | QgsComposerItem * | item | ) | const |
QgsComposerItem * QgsComposition::getComposerItemBelow | ( | QgsComposerItem * | item | ) | const |
const QgsComposerItem * QgsComposition::getComposerItemById | ( | const QString | theId | ) | const |
Returns a composer item given its text identifier.
Ids are not necessarely unique, but this function returns only one element.
theId | - A QString representing the identifier of the item to retrieve. |
const QgsComposerItem * QgsComposition::getComposerItemByUuid | ( | const QString | theUuid | ) | const |
Returns a composer item given its unique identifier.
theUuid | A QString representing the UUID of the item to |
const QgsComposerMap * QgsComposition::getComposerMapById | ( | const int | id | ) | const |
Returns the composer map with specified id.
|
inline |
|
inline |
|
inline |
QgsComposerItemGroup * QgsComposition::groupItems | ( | QList< QgsComposerItem * > | items | ) |
Creates a new group from a list of composer items and adds it to the composition.
items | items to include in group |
|
protected |
int QgsComposition::itemPageNumber | ( | const QgsComposerItem * | item | ) | const |
Returns on which page number (0-based) is displayed an item.
|
signal |
Is emitted when a composer item has been removed from the scene.
|
inline |
Returns the items model attached to the composition.
bool QgsComposition::loadFromTemplate | ( | const QDomDocument & | doc, |
QMap< QString, QString > * | substitutionMap = 0 , |
||
bool | addUndoCommands = false , |
||
const bool | clearComposition = true |
||
) |
Load a template document.
doc | template document |
substitutionMap | map with text to replace. Text needs to be enclosed by brackets (e.g. '[text]' ) |
addUndoCommands | whether or not to add undo commands |
clearComposition | set to true to clear the existing composition and read all composition and atlas properties from the template. Set to false to only add new items from the template, without overwriting the existing items or composition settings. |
void QgsComposition::lockSelectedItems | ( | ) |
Lock the selected items.
bool QgsComposition::lowerItem | ( | QgsComposerItem * | item | ) |
void QgsComposition::lowerSelectedItems | ( | ) |
|
inline |
Returns pointer to map renderer of qgis map canvas.
|
inline |
Return setting of QGIS map canvas.
bool QgsComposition::moveItemToBottom | ( | QgsComposerItem * | item | ) |
bool QgsComposition::moveItemToTop | ( | QgsComposerItem * | item | ) |
void QgsComposition::moveSelectedItemsToBottom | ( | ) |
void QgsComposition::moveSelectedItemsToTop | ( | ) |
QGraphicsLineItem * QgsComposition::nearestSnapLine | ( | const bool | horizontal, |
const double | x, | ||
const double | y, | ||
const double | tolerance, | ||
QList< QPair< QgsComposerItem *, QgsComposerItem::ItemPositionMode > > & | snappedItems | ||
) | const |
Get nearest snap line.
|
signal |
int QgsComposition::numPages | ( | ) | const |
bool QgsComposition::pageIsEmpty | ( | const int | page | ) | const |
Returns whether a page is empty, ie, it contains no items except for the background paper item.
page | page number, starting with 1 |
int QgsComposition::pageNumberAt | ( | const QPointF & | position | ) | const |
Returns the page number (0-based) given a coordinate.
int QgsComposition::pageNumberForPoint | ( | const QPointF & | position | ) | const |
Returns the page number corresponding to a point in the composition.
|
inline |
Return pages in the correct order.
|
inline |
Note: added in version 2.1.
double QgsComposition::paperHeight | ( | ) | const |
|
signal |
double QgsComposition::paperWidth | ( | ) | const |
int QgsComposition::pixelFontSize | ( | double | pointSize | ) | const |
Returns the mm font size for a font that has point size set.
Each item that sets a font should call this function before drawing text
|
inline |
double QgsComposition::pointFontSize | ( | int | pixelSize | ) | const |
Does the inverse calculation and returns points for mm.
QPointF QgsComposition::positionOnPage | ( | const QPointF & | position | ) | const |
Returns the position within a page of a point in the composition.
|
inline |
bool QgsComposition::print | ( | QPrinter & | printer, |
const bool | evaluateDDPageSize = false |
||
) |
Convenience function that prepares the printer and prints.
|
inline |
QImage QgsComposition::printPageAsRaster | ( | int | page | ) |
print composer page to image If the image does not fit into memory, a null image is returned
|
inline |
|
signal |
Is emitted when the compositions print resolution changes.
void QgsComposition::pushAddRemoveCommand | ( | QgsComposerItem * | item, |
const QString & | text, | ||
const QgsAddRemoveItemCommand::State | state = QgsAddRemoveItemCommand::Added |
||
) |
Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack.
bool QgsComposition::raiseItem | ( | QgsComposerItem * | item | ) |
void QgsComposition::raiseSelectedItems | ( | ) |
bool QgsComposition::readXML | ( | const QDomElement & | compositionElem, |
const QDomDocument & | doc | ||
) |
Reads settings from xml file.
|
slot |
Refreshes a data defined property for the composition by reevaluating the property's value and redrawing the composition with this new value.
property | data defined property to refresh. If property is set to QgsComposerItem::AllProperties then all data defined properties for the composition will be refreshed. |
|
slot |
Forces items in the composition to refresh.
For instance, this causes maps to redraw and rebuild cached images, html items to reload their source url, and attribute tables to refresh their contents. Calling this also triggers a recalculation of all data defined attributes within the composition.
|
signal |
Is emitted when item in the composition must be refreshed.
void QgsComposition::refreshZList | ( | ) |
Rebuilds the z order list by adding any item which are present in the composition but missing from the z order list.
|
static |
Returns a scaled position given a before and after range.
|
static |
Resizes a QRectF relative to the change from boundsBefore to boundsAfter.
void QgsComposition::removeComposerItem | ( | QgsComposerItem * | item, |
const bool | createCommand = true , |
||
const bool | removeGroupItems = true |
||
) |
Remove item from the graphics scene.
Additionally to QGraphicsScene::removeItem, this function considers undo/redo command
void QgsComposition::removeItemFromZList | ( | QgsComposerItem * | item | ) |
Removes item from z list.
Usually called from destructor of QgsComposerItem
void QgsComposition::removeMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Removes multi frame (but does not delete it)
void QgsComposition::removeSnapLine | ( | QGraphicsLineItem * | line | ) |
Remove custom snap line (and delete the object)
void QgsComposition::renderPage | ( | QPainter * | p, |
int | page | ||
) |
Render a page to a paint device.
p | destination painter |
page | page number, 0 based such that the first page is page 0 |
QList< QgsComposerItem * > QgsComposition::selectedComposerItems | ( | const bool | includeLockedItems = true | ) |
Returns list of selected composer items.
includeLockedItems | set to true to include locked items in list |
|
signal |
Is emitted when selected item changed.
If 0, no item is selected
|
inline |
Returns pointer to selection handles.
void QgsComposition::selectNextByZOrder | ( | const ZValueDirection | direction | ) |
|
slot |
Casts object to the proper subclass type and calls corresponding itemAdded signal.
|
inline |
|
inline |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items.
t | snap tolerance in pixels |
|
slot |
Clears any selected items in the composition.
Call this method rather than QGraphicsScene::clearSelection, as the latter does not correctly emit signals to allow the composition's model to update.
bool QgsComposition::setAtlasMode | ( | const QgsComposition::AtlasMode | mode | ) |
Sets the current atlas mode of the composition.
mode | atlas mode to switch to |
void QgsComposition::setDataDefinedProperty | ( | const QgsComposerObject::DataDefinedProperty | property, |
bool | active, | ||
bool | useExpression, | ||
const QString & | expression, | ||
const QString & | field | ||
) |
Sets parameters for a data defined property for the composition.
property | data defined property to set |
active | true if data defined property is active, false if it is disabled |
useExpression | true if the expression should be used |
expression | expression for data defined property |
field | field name if the data defined property should take its value from a field |
|
inline |
void QgsComposition::setGridPen | ( | const QPen & | p | ) |
void QgsComposition::setGridStyle | ( | const GridStyle | s | ) |
void QgsComposition::setGridVisible | ( | const bool | b | ) |
void QgsComposition::setNumPages | ( | const int | pages | ) |
void QgsComposition::setPageStyleSymbol | ( | QgsFillSymbolV2 * | symbol | ) |
Note: added in version 2.1.
void QgsComposition::setPaperSize | ( | const double | width, |
const double | height | ||
) |
Changes size of paper item.
Also moves all items so that they retain their same relative position to the top left corner of their current page.
width | page width in mm |
height | page height in mm |
|
inline |
|
inline |
If true, prevents any mouse cursor changes by the composition or by any composer items Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes.
|
inline |
void QgsComposition::setPrintResolution | ( | const int | dpi | ) |
|
slot |
Clears any selected items and sets an item as the current selection.
item | item to set as selected |
|
inline |
void QgsComposition::setSnapGridOffsetX | ( | const double | offset | ) |
void QgsComposition::setSnapGridOffsetY | ( | const double | offset | ) |
void QgsComposition::setSnapGridResolution | ( | const double | r | ) |
|
inline |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.
tolerance | snap tolerance in pixels |
void QgsComposition::setSnapLinesVisible | ( | const bool | visible | ) |
Hides / shows custom snap lines.
void QgsComposition::setSnapToGridEnabled | ( | const bool | b | ) |
|
inline |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items.
snapTolerance | snap tolerance in pixels |
void QgsComposition::setStatusMessage | ( | const QString & | message | ) |
Sets the status bar message for the composer window.
void QgsComposition::setUseAdvancedEffects | ( | const bool | effectsEnabled | ) |
Used to enable or disable advanced effects such as blend modes in a composition.
|
inline |
bool QgsComposition::shouldExportPage | ( | const int | page | ) | const |
Returns whether a specified page number should be included in exports of the composition.
page | page number, starting with 1 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.
|
inline |
Returns pointer to snap lines collection.
|
inline |
QPointF QgsComposition::snapPointToGrid | ( | const QPointF & | scenePoint | ) | const |
Snaps a scene coordinate point to grid.
|
inline |
|
inline |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to guides and the edges and centers of other items.
|
inline |
Sorts the zList.
The only time where this function needs to be called is from QgsComposer after reading all the items from xml file
|
inline |
Returns the vertical space between pages in a composer view.
|
signal |
Is emitted when the composition has an updated status bar message for the composer window.
|
inline |
Returns pointer to undo/redo command storage.
QList< QgsComposerItem * > QgsComposition::ungroupItems | ( | QgsComposerItemGroup * | group | ) |
Ungroups items by removing them from an item group and removing the group from the composition.
group | item group to ungroup |
void QgsComposition::unlockAllItems | ( | ) |
Unlock all items.
|
slot |
Updates the scene bounds of the composition.
void QgsComposition::updateSettings | ( | ) |
Refreshes the composition when composer related options change.
|
inline |
Returns true if a composition should use advanced effects such as blend modes.
|
inline |
bool QgsComposition::writeXML | ( | QDomElement & | composerElem, |
QDomDocument & | doc | ||
) |
Writes settings to xml (paper dimension)
|
friend |
|
friend |