QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
QgsComposition Class Reference

Graphics scene for map printing. More...

#include <qgscomposition.h>

Inheritance diagram for QgsComposition:
Inheritance graph
[legend]

Public Types

enum  AtlasMode { AtlasOff, PreviewAtlas, ExportAtlas }
 Composition atlas modes. More...
 
enum  GridStyle { Solid, Dots, Crosses }
 Style to draw the snapping grid. More...
 
enum  PaperOrientation { Portrait, Landscape }
 
enum  PlotStyle { Preview = 0, Print, Postscript }
 Plot type. More...
 
enum  ZValueDirection { ZValueBelow, ZValueAbove }
 

Public Slots

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. More...
 
void refreshItems ()
 Forces items in the composition to refresh. More...
 
void sendItemAddedSignal (QgsComposerItem *item)
 Casts object to the proper subclass type and calls corresponding itemAdded signal. More...
 
void setAllUnselected ()
 Clears any selected items in the composition. More...
 
void setSelectedItem (QgsComposerItem *item)
 Clears any selected items and sets an item as the current selection. More...
 
void updateBounds ()
 Updates the scene bounds of the composition. More...
 

Signals

void composerArrowAdded (QgsComposerArrow *arrow)
 Is emitted when new composer arrow has been added to the view. More...
 
void composerHtmlFrameAdded (QgsComposerHtml *html, QgsComposerFrame *frame)
 Is emitted when a new composer html has been added to the view. More...
 
void composerLabelAdded (QgsComposerLabel *label)
 Is emitted when new composer label has been added to the view. More...
 
void composerLegendAdded (QgsComposerLegend *legend)
 Is emitted when a new composer legend has been added. More...
 
void composerMapAdded (QgsComposerMap *map)
 Is emitted when new composer map has been added to the view. More...
 
void composerPictureAdded (QgsComposerPicture *picture)
 Is emitted when a new composer picture has been added. More...
 
void composerScaleBarAdded (QgsComposerScaleBar *scalebar)
 Is emitted when new composer scale bar has been added. More...
 
void composerShapeAdded (QgsComposerShape *shape)
 Is emitted when a new composer shape has been added. More...
 
void composerTableAdded (QgsComposerAttributeTable *table)
 Is emitted when a new composer table has been added. More...
 
void composerTableFrameAdded (QgsComposerAttributeTableV2 *table, QgsComposerFrame *frame)
 Is emitted when a new composer table frame has been added to the view. More...
 
void itemRemoved (QgsComposerItem *)
 Is emitted when a composer item has been removed from the scene. More...
 
void nPagesChanged ()
 
void paperSizeChanged ()
 
void printResolutionChanged ()
 Is emitted when the compositions print resolution changes. More...
 
void refreshItemsTriggered ()
 Is emitted when item in the composition must be refreshed. More...
 
void selectedItemChanged (QgsComposerItem *selected)
 Is emitted when selected item changed. More...
 
void statusMsgChanged (QString message)
 Is emitted when the composition has an updated status bar message for the composer window. More...
 

Public Member Functions

Q_DECL_DEPRECATED QgsComposition (QgsMapRenderer *mapRenderer)
 
 QgsComposition (const QgsMapSettings &mapSettings)
 
 ~QgsComposition ()
 
void addComposerArrow (QgsComposerArrow *arrow)
 Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerHtmlFrame (QgsComposerHtml *html, QgsComposerFrame *frame)
 Adds composer html frame and advises composer to create a widget for it (through signal) More...
 
void addComposerLabel (QgsComposerLabel *label)
 Adds label to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerLegend (QgsComposerLegend *legend)
 Adds legend to the graphics scene and advices composer to create a widget for it (through signal) More...
 
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) More...
 
void addComposerPicture (QgsComposerPicture *picture)
 Adds picture to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerScaleBar (QgsComposerScaleBar *scaleBar)
 Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerShape (QgsComposerShape *shape)
 Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerTable (QgsComposerAttributeTable *table)
 Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal) More...
 
void addComposerTableFrame (QgsComposerAttributeTableV2 *table, QgsComposerFrame *frame)
 Adds composer tablev2 frame and advises composer to create a widget for it (through signal) More...
 
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) More...
 
void addItemToZList (QgsComposerItem *item)
 Adds item to z list. More...
 
void addMultiFrame (QgsComposerMultiFrame *multiFrame)
 Adds multiframe. More...
 
QGraphicsLineItemaddSnapLine ()
 Add a custom snap line (can be horizontal or vertical) More...
 
bool alignmentSnap () const
 
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. More...
 
void alignSelectedItemsBottom ()
 
void alignSelectedItemsHCenter ()
 
void alignSelectedItemsLeft ()
 
void alignSelectedItemsRight ()
 
void alignSelectedItemsTop ()
 
void alignSelectedItemsVCenter ()
 
QgsAtlasCompositionatlasComposition ()
 
QgsComposition::AtlasMode atlasMode () const
 Returns the current atlas mode of the composition. More...
 
void beginCommand (QgsComposerItem *item, const QString &commandText, const QgsComposerMergeCommand::Context c=QgsComposerMergeCommand::Unknown)
 Allocates new item command and saves initial state in it. More...
 
void beginMultiFrameCommand (QgsComposerMultiFrame *multiFrame, const QString &text, const QgsComposerMultiFrameMergeCommand::Context c=QgsComposerMultiFrameMergeCommand::Unknown)
 
void beginPrint (QPrinter &printer, const bool evaluateDDPageSize=false)
 Prepare the printer for printing. More...
 
void beginPrintAsPDF (QPrinter &printer, const QString &file)
 Prepare the printer for printing in a PDF. More...
 
bool boundingBoxesVisible () const
 Returns whether selection bounding boxes should be shown in the composition. More...
 
void cancelCommand ()
 Deletes current command. More...
 
void cancelMultiFrameCommand ()
 Deletes current multi frame command. More...
 
void clearSnapLines ()
 Removes all snap lines. More...
 
QgsComposerItemcomposerItemAt (const QPointF &position, const bool ignoreLocked=false) const
 Returns the topmost composer item at a specified position. More...
 
QgsComposerItemcomposerItemAt (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. More...
 
template<class T >
void composerItems (QList< T * > &itemList)
 Return composer items of a specific type. More...
 
template<class T >
void composerItemsOnPage (QList< T * > &itemList, const int pageNumber) const
 Return composer items of a specific type on a specified page. More...
 
QList< const QgsComposerMap * > composerMapItems () const
 Returns pointers to all composer maps in the scene. More...
 
void computeWorldFileParameters (double &a, double &b, double &c, double &d, double &e, double &f) const
 Compute world file parameters. More...
 
QgsDataDefineddataDefinedProperty (const QgsComposerObject::DataDefinedProperty property)
 Returns a reference to the data defined settings for one of the composition's data defined properties. More...
 
void doPrint (QPrinter &printer, QPainter &painter, bool startNewPage=false)
 Print on a preconfigured printer. More...
 
void endCommand ()
 Saves end state of item and pushes command to the undo history. More...
 
void endMultiFrameCommand ()
 
bool exportAsPDF (const QString &file)
 Convenience function that prepares the printer for printing in PDF and prints. More...
 
bool generateWorldFile () const
 
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). More...
 
QgsComposerItemgetComposerItemAbove (QgsComposerItem *item) const
 
QgsComposerItemgetComposerItemBelow (QgsComposerItem *item) const
 
const QgsComposerItemgetComposerItemById (const QString theId) const
 Returns a composer item given its text identifier. More...
 
const QgsComposerItemgetComposerItemByUuid (const QString theUuid) const
 Returns a composer item given its unique identifier. More...
 
const QgsComposerMapgetComposerMapById (const int id) const
 Returns the composer map with specified id. More...
 
const QPengridPen () const
 
GridStyle gridStyle () const
 
bool gridVisible () const
 
QgsComposerItemGroupgroupItems (QList< QgsComposerItem * > items)
 Creates a new group from a list of composer items and adds it to the composition. More...
 
int itemPageNumber (const QgsComposerItem *) const
 Returns on which page number (0-based) is displayed an item. More...
 
QgsComposerModelitemsModel ()
 Returns the items model attached to the composition. More...
 
bool loadFromTemplate (const QDomDocument &doc, QMap< QString, QString > *substitutionMap=0, bool addUndoCommands=false, const bool clearComposition=true)
 Load a template document. More...
 
void lockSelectedItems ()
 Lock the selected items. More...
 
bool lowerItem (QgsComposerItem *item)
 
void lowerSelectedItems ()
 
Q_DECL_DEPRECATED QgsMapRenderermapRenderer ()
 Returns pointer to map renderer of qgis map canvas. More...
 
const QgsMapSettingsmapSettings () const
 Return setting of QGIS map canvas. More...
 
bool moveItemToBottom (QgsComposerItem *item)
 
bool moveItemToTop (QgsComposerItem *item)
 
void moveSelectedItemsToBottom ()
 
void moveSelectedItemsToTop ()
 
QGraphicsLineItemnearestSnapLine (const bool horizontal, const double x, const double y, const double tolerance, QList< QPair< QgsComposerItem *, QgsComposerItem::ItemPositionMode > > &snappedItems) const
 Get nearest snap line. More...
 
int numPages () const
 Returns the number of pages in the composition. More...
 
bool pageIsEmpty (const int page) const
 Returns whether a page is empty, ie, it contains no items except for the background paper item. More...
 
int pageNumberAt (const QPointF &position) const
 Returns the page number (0-based) given a coordinate. More...
 
int pageNumberForPoint (const QPointF &position) const
 Returns the page number corresponding to a point in the composition. More...
 
QList< QgsPaperItem * > pages ()
 Return pages in the correct order. More...
 
QgsFillSymbolV2pageStyleSymbol ()
 Note: added in version 2.1. More...
 
double paperHeight () const
 Height of paper item. More...
 
double paperWidth () const
 Width of paper item. More...
 
Q_DECL_DEPRECATED int pixelFontSize (double pointSize) const
 Returns the mm font size for a font that has point size set. More...
 
QgsComposition::PlotStyle plotStyle () const
 
Q_DECL_DEPRECATED double pointFontSize (int pixelSize) const
 Does the inverse calculation and returns points for mm. More...
 
QPointF positionOnPage (const QPointF &position) const
 Returns the position within a page of a point in the composition. More...
 
bool preventCursorChange () const
 
bool print (QPrinter &printer, const bool evaluateDDPageSize=false)
 Convenience function that prepares the printer and prints. More...
 
bool printAsRaster () const
 
QImage printPageAsRaster (int page)
 print composer page to image If the image does not fit into memory, a null image is returned More...
 
int printResolution () const
 
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. More...
 
bool raiseItem (QgsComposerItem *item)
 
void raiseSelectedItems ()
 
bool readXML (const QDomElement &compositionElem, const QDomDocument &doc)
 Reads settings from xml file. More...
 
void refreshZList ()
 Rebuilds the z order list by adding any item which are present in the composition but missing from the z order list. More...
 
void removeComposerItem (QgsComposerItem *item, const bool createCommand=true, const bool removeGroupItems=true)
 Remove item from the graphics scene. More...
 
void removeItemFromZList (QgsComposerItem *item)
 Removes item from z list. More...
 
void removeMultiFrame (QgsComposerMultiFrame *multiFrame)
 Removes multi frame (but does not delete it) More...
 
void removeSnapLine (QGraphicsLineItem *line)
 Remove custom snap line (and delete the object) More...
 
void renderPage (QPainter *p, int page)
 Render a page to a paint device. More...
 
QList< QgsComposerItem * > selectedComposerItems (const bool includeLockedItems=true)
 Returns list of selected composer items. More...
 
QgsComposerMouseHandlesselectionHandles ()
 Returns pointer to selection handles. More...
 
void selectNextByZOrder (const ZValueDirection direction)
 
void setAlignmentSnap (const bool s)
 
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. More...
 
bool setAtlasMode (const QgsComposition::AtlasMode mode)
 Sets the current atlas mode of the composition. More...
 
void setBoundingBoxesVisible (const bool boundsVisible)
 Sets whether selection bounding boxes should be shown in the composition. More...
 
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. More...
 
void setGenerateWorldFile (const bool enabled)
 
void setGridPen (const QPen &p)
 
void setGridStyle (const GridStyle s)
 
void setGridVisible (const bool b)
 
void setNumPages (const int pages)
 Sets the number of pages for the composition. More...
 
void setPageStyleSymbol (QgsFillSymbolV2 *symbol)
 Note: added in version 2.1. More...
 
void setPaperSize (const double width, const double height)
 Changes size of paper item. More...
 
void setPlotStyle (const QgsComposition::PlotStyle style)
 
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. More...
 
void setPrintAsRaster (const bool enabled)
 
void setPrintResolution (const int dpi)
 
void setSmartGuidesEnabled (const bool b)
 
void setSnapGridOffsetX (const double offset)
 
void setSnapGridOffsetY (const double offset)
 
void setSnapGridResolution (const double r)
 
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. More...
 
void setSnapLinesVisible (const bool visible)
 Hides / shows custom snap lines. More...
 
void setSnapToGridEnabled (const bool b)
 
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. More...
 
void setStatusMessage (const QString &message)
 Sets the status bar message for the composer window. More...
 
void setUseAdvancedEffects (const bool effectsEnabled)
 Used to enable or disable advanced effects such as blend modes in a composition. More...
 
void setWorldFileMap (QgsComposerMap *map)
 
bool shouldExportPage (const int page) const
 Returns whether a specified page number should be included in exports of the composition. More...
 
bool smartGuidesEnabled () const
 
double snapGridOffsetX () const
 
double snapGridOffsetY () const
 
double snapGridResolution () const
 
Q_DECL_DEPRECATED double snapGridTolerance () const
 Returns the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid. More...
 
QList< QGraphicsLineItem * > * snapLines ()
 Returns pointer to snap lines collection. More...
 
bool snapLinesVisible () const
 
QPointF snapPointToGrid (const QPointF &scenePoint) const
 Snaps a scene coordinate point to grid. More...
 
bool snapToGridEnabled () const
 
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. More...
 
Q_DECL_DEPRECATED void sortZList ()
 Sorts the zList. More...
 
double spaceBetweenPages () const
 Returns the vertical space between pages in a composer view. More...
 
QUndoStackundoStack ()
 Returns pointer to undo/redo command storage. More...
 
QList< QgsComposerItem * > ungroupItems (QgsComposerItemGroup *group)
 Ungroups items by removing them from an item group and removing the group from the composition. More...
 
void unlockAllItems ()
 Unlock all items. More...
 
void updateSettings ()
 Refreshes the composition when composer related options change. More...
 
bool useAdvancedEffects () const
 Returns true if a composition should use advanced effects such as blend modes. More...
 
QgsComposerMapworldFileMap () const
 
bool writeXML (QDomElement &composerElem, QDomDocument &doc)
 Writes settings to xml (paper dimension) More...
 
- Public Member Functions inherited from QGraphicsScene
 QGraphicsScene (QObject *parent)
 
 QGraphicsScene (const QRectF &sceneRect, QObject *parent)
 
 QGraphicsScene (qreal x, qreal y, qreal width, qreal height, QObject *parent)
 
virtual  ~QGraphicsScene ()
 
QGraphicsItemactivePanel () const
 
QGraphicsWidgetactiveWindow () const
 
QGraphicsEllipseItemaddEllipse (const QRectF &rect, const QPen &pen, const QBrush &brush)
 
QGraphicsEllipseItemaddEllipse (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush)
 
void addItem (QGraphicsItem *item)
 
QGraphicsLineItemaddLine (const QLineF &line, const QPen &pen)
 
QGraphicsLineItemaddLine (qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen)
 
QGraphicsPathItemaddPath (const QPainterPath &path, const QPen &pen, const QBrush &brush)
 
QGraphicsPixmapItemaddPixmap (const QPixmap &pixmap)
 
QGraphicsPolygonItemaddPolygon (const QPolygonF &polygon, const QPen &pen, const QBrush &brush)
 
QGraphicsRectItemaddRect (const QRectF &rect, const QPen &pen, const QBrush &brush)
 
QGraphicsRectItemaddRect (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush)
 
QGraphicsSimpleTextItemaddSimpleText (const QString &text, const QFont &font)
 
QGraphicsTextItemaddText (const QString &text, const QFont &font)
 
QGraphicsProxyWidgetaddWidget (QWidget *widget, QFlags< Qt::WindowType > wFlags)
 
void advance ()
 
QBrush backgroundBrush () const
 
int bspTreeDepth () const
 
void changed (const QList< QRectF > &region)
 
void clear ()
 
void clearFocus ()
 
void clearSelection ()
 
QList< QGraphicsItem * > collidingItems (const QGraphicsItem *item, Qt::ItemSelectionMode mode) const
 
QGraphicsItemGroupcreateItemGroup (const QList< QGraphicsItem * > &items)
 
void destroyItemGroup (QGraphicsItemGroup *group)
 
QGraphicsItemfocusItem () const
 
QFont font () const
 
QBrush foregroundBrush () const
 
bool hasFocus () const
 
qreal height () const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
void invalidate (qreal x, qreal y, qreal w, qreal h, QFlags< QGraphicsScene::SceneLayer > layers)
 
void invalidate (const QRectF &rect, QFlags< QGraphicsScene::SceneLayer > layers)
 
bool isActive () const
 
bool isSortCacheEnabled () const
 
QGraphicsItemitemAt (qreal x, qreal y) const
 
QGraphicsItemitemAt (qreal x, qreal y, const QTransform &deviceTransform) const
 
QGraphicsItemitemAt (const QPointF &position) const
 
QGraphicsItemitemAt (const QPointF &position, const QTransform &deviceTransform) const
 
ItemIndexMethod itemIndexMethod () const
 
QList< QGraphicsItem * > items (qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > items () const
 
QList< QGraphicsItem * > items (Qt::SortOrder order) const
 
QList< QGraphicsItem * > items (const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > items (const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > items (const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > items (const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > items (const QPointF &pos) const
 
QList< QGraphicsItem * > items (const QRectF &rectangle, Qt::ItemSelectionMode mode) const
 
QList< QGraphicsItem * > items (const QPolygonF &polygon, Qt::ItemSelectionMode mode) const
 
QList< QGraphicsItem * > items (const QPainterPath &path, Qt::ItemSelectionMode mode) const
 
QList< QGraphicsItem * > items (qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const
 
QRectF itemsBoundingRect () const
 
QGraphicsItemmouseGrabberItem () const
 
QPalette palette () const
 
void removeItem (QGraphicsItem *item)
 
void render (QPainter *painter, const QRectF &target, const QRectF &source, Qt::AspectRatioMode aspectRatioMode)
 
QRectF sceneRect () const
 
void sceneRectChanged (const QRectF &rect)
 
QList< QGraphicsItem * > selectedItems () const
 
QPainterPath selectionArea () const
 
void selectionChanged ()
 
bool sendEvent (QGraphicsItem *item, QEvent *event)
 
void setActivePanel (QGraphicsItem *item)
 
void setActiveWindow (QGraphicsWidget *widget)
 
void setBackgroundBrush (const QBrush &brush)
 
void setBspTreeDepth (int depth)
 
void setFocus (Qt::FocusReason focusReason)
 
void setFocusItem (QGraphicsItem *item, Qt::FocusReason focusReason)
 
void setFont (const QFont &font)
 
void setForegroundBrush (const QBrush &brush)
 
void setItemIndexMethod (ItemIndexMethod method)
 
void setPalette (const QPalette &palette)
 
void setSceneRect (qreal x, qreal y, qreal w, qreal h)
 
void setSceneRect (const QRectF &rect)
 
void setSelectionArea (const QPainterPath &path, const QTransform &deviceTransform)
 
void setSelectionArea (const QPainterPath &path)
 
void setSelectionArea (const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform)
 
void setSelectionArea (const QPainterPath &path, Qt::ItemSelectionMode mode)
 
void setSortCacheEnabled (bool enabled)
 
void setStickyFocus (bool enabled)
 
void setStyle (QStyle *style)
 
bool stickyFocus () const
 
QStylestyle () const
 
void update (const QRectF &rect)
 
void update (qreal x, qreal y, qreal w, qreal h)
 
QList< QGraphicsView * > views () const
 
qreal width () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Static Public Member Functions

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. More...
 
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. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

void init ()
 
- Protected Member Functions inherited from QGraphicsScene
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *contextMenuEvent)
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void drawBackground (QPainter *painter, const QRectF &rect)
 
virtual void drawForeground (QPainter *painter, const QRectF &rect)
 
virtual void drawItems (QPainter *painter, int numItems, QGraphicsItem *[] items, const QStyleOptionGraphicsItem[] options, QWidget *widget)
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual void focusInEvent (QFocusEvent *focusEvent)
 
bool focusNextPrevChild (bool next)
 
virtual void focusOutEvent (QFocusEvent *focusEvent)
 
virtual void helpEvent (QGraphicsSceneHelpEvent *helpEvent)
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void keyPressEvent (QKeyEvent *keyEvent)
 
virtual void keyReleaseEvent (QKeyEvent *keyEvent)
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *mouseEvent)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *mouseEvent)
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *mouseEvent)
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *wheelEvent)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Friends

class QgsComposerModel
 
class QgsComposerObject
 

Additional Inherited Members

- Public Attributes inherited from QGraphicsScene
typedef SceneLayers
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QGraphicsScene
 backgroundBrush
 
 bspTreeDepth
 
 font
 
 foregroundBrush
 
 itemIndexMethod
 
 palette
 
 sceneRect
 
 sortCacheEnabled
 
 stickyFocus
 
- Properties inherited from QObject
 objectName
 

Detailed Description

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.

Definition at line 73 of file qgscomposition.h.

Member Enumeration Documentation

Composition atlas modes.

Enumerator
AtlasOff 
PreviewAtlas 
ExportAtlas 

Definition at line 111 of file qgscomposition.h.

Style to draw the snapping grid.

Enumerator
Solid 
Dots 
Crosses 

Definition at line 87 of file qgscomposition.h.

Enumerator
Portrait 
Landscape 

Definition at line 100 of file qgscomposition.h.

Plot type.

Enumerator
Preview 
Print 
Postscript 

Definition at line 79 of file qgscomposition.h.

Enumerator
ZValueBelow 
ZValueAbove 

Definition at line 94 of file qgscomposition.h.

Constructor & Destructor Documentation

QgsComposition::QgsComposition ( QgsMapRenderer mapRenderer)
Deprecated:
since 2.4 - use the constructor with QgsMapSettings

Definition at line 59 of file qgscomposition.cpp.

QgsComposition::QgsComposition ( const QgsMapSettings mapSettings)
explicit

Definition at line 68 of file qgscomposition.cpp.

QgsComposition::~QgsComposition ( )

Definition at line 185 of file qgscomposition.cpp.

Member Function Documentation

void QgsComposition::addComposerArrow ( QgsComposerArrow arrow)

Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)

Note
not available in python bindings

Definition at line 2301 of file qgscomposition.cpp.

void QgsComposition::addComposerHtmlFrame ( QgsComposerHtml html,
QgsComposerFrame frame 
)

Adds composer html frame and advises composer to create a widget for it (through signal)

Definition at line 2391 of file qgscomposition.cpp.

void QgsComposition::addComposerLabel ( QgsComposerLabel label)

Adds label to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2311 of file qgscomposition.cpp.

void QgsComposition::addComposerLegend ( QgsComposerLegend legend)

Adds legend to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2351 of file qgscomposition.cpp.

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)

Definition at line 2321 of file qgscomposition.cpp.

void QgsComposition::addComposerPicture ( QgsComposerPicture picture)

Adds picture to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2361 of file qgscomposition.cpp.

void QgsComposition::addComposerScaleBar ( QgsComposerScaleBar scaleBar)

Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2341 of file qgscomposition.cpp.

void QgsComposition::addComposerShape ( QgsComposerShape shape)

Adds a composer shape to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2371 of file qgscomposition.cpp.

void QgsComposition::addComposerTable ( QgsComposerAttributeTable table)

Adds a composer table to the graphics scene and advices composer to create a widget for it (through signal)

Definition at line 2381 of file qgscomposition.cpp.

void QgsComposition::addComposerTableFrame ( QgsComposerAttributeTableV2 table,
QgsComposerFrame frame 
)

Adds composer tablev2 frame and advises composer to create a widget for it (through signal)

Definition at line 2401 of file qgscomposition.cpp.

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)

Parameters
elemitems parent element, e.g.
<Composer> 
or
<ComposerItemClipboard> 
docxml document
mapsToRestorefor reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand
addUndoCommandsinsert AddItem commands if true (e.g. for copy/paste)
positem position. Optional, take position from xml if 0
pasteInPlacewhether the position should be kept but mapped to the page origin. (the page is the page under to the mouse cursor)
Note
parameters mapsToRestore, addUndoCommands pos and pasteInPlace not available in python bindings

Definition at line 1047 of file qgscomposition.cpp.

void QgsComposition::addItemToZList ( QgsComposerItem item)

Adds item to z list.

Usually called from constructor of QgsComposerItem

Definition at line 1398 of file qgscomposition.cpp.

void QgsComposition::addMultiFrame ( QgsComposerMultiFrame multiFrame)

Adds multiframe.

The object is owned by QgsComposition until removeMultiFrame is called

Definition at line 2287 of file qgscomposition.cpp.

QGraphicsLineItem * QgsComposition::addSnapLine ( )

Add a custom snap line (can be horizontal or vertical)

Definition at line 1925 of file qgscomposition.cpp.

bool QgsComposition::alignmentSnap ( ) const
inline

Definition at line 216 of file qgscomposition.h.

Q_DECL_DEPRECATED double QgsComposition::alignmentSnapTolerance ( ) const
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.

Returns
snap tolerance in pixels
See Also
setAlignmentSnapTolerance
Deprecated:
Use snapTolerance instead

Definition at line 269 of file qgscomposition.h.

void QgsComposition::alignSelectedItemsBottom ( )

Definition at line 1722 of file qgscomposition.cpp.

void QgsComposition::alignSelectedItemsHCenter ( )

Definition at line 1605 of file qgscomposition.cpp.

void QgsComposition::alignSelectedItemsLeft ( )

Definition at line 1575 of file qgscomposition.cpp.

void QgsComposition::alignSelectedItemsRight ( )

Definition at line 1635 of file qgscomposition.cpp.

void QgsComposition::alignSelectedItemsTop ( )

Definition at line 1665 of file qgscomposition.cpp.

void QgsComposition::alignSelectedItemsVCenter ( )

Definition at line 1694 of file qgscomposition.cpp.

QgsAtlasComposition& QgsComposition::atlasComposition ( )
inline

Definition at line 617 of file qgscomposition.h.

QgsComposition::AtlasMode QgsComposition::atlasMode ( ) const
inline

Returns the current atlas mode of the composition.

Returns
current atlas mode
See Also
setAtlasMode

Definition at line 633 of file qgscomposition.h.

void QgsComposition::beginCommand ( QgsComposerItem item,
const QString commandText,
const QgsComposerMergeCommand::Context  c = QgsComposerMergeCommand::Unknown 
)

Allocates new item command and saves initial state in it.

Parameters
itemtarget item
commandTextdescriptive command text
ccontext for merge commands (unknown for non-mergeable commands)

Definition at line 2198 of file qgscomposition.cpp.

void QgsComposition::beginMultiFrameCommand ( QgsComposerMultiFrame multiFrame,
const QString text,
const QgsComposerMultiFrameMergeCommand::Context  c = QgsComposerMultiFrameMergeCommand::Unknown 
)

Definition at line 2242 of file qgscomposition.cpp.

void QgsComposition::beginPrint ( QPrinter printer,
const bool  evaluateDDPageSize = false 
)

Prepare the printer for printing.

Definition at line 2715 of file qgscomposition.cpp.

void QgsComposition::beginPrintAsPDF ( QPrinter printer,
const QString file 
)

Prepare the printer for printing in a PDF.

Definition at line 2626 of file qgscomposition.cpp.

bool QgsComposition::boundingBoxesVisible ( ) const
inline

Returns whether selection bounding boxes should be shown in the composition.

Returns
true if selection bounding boxes should be shown
See Also
setBoundingBoxesVisible
Note
added in QGIS 2.7

Definition at line 299 of file qgscomposition.h.

void QgsComposition::cancelCommand ( )

Deletes current command.

Definition at line 2236 of file qgscomposition.cpp.

void QgsComposition::cancelMultiFrameCommand ( )

Deletes current multi frame command.

Definition at line 2281 of file qgscomposition.cpp.

void QgsComposition::clearSnapLines ( )

Removes all snap lines.

Definition at line 1948 of file qgscomposition.cpp.

void QgsComposition::composerArrowAdded ( QgsComposerArrow arrow)
signal

Is emitted when new composer arrow has been added to the view.

void QgsComposition::composerHtmlFrameAdded ( QgsComposerHtml html,
QgsComposerFrame frame 
)
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.

Parameters
positionpoint to search for item at
ignoreLockedset to true to ignore locked items
Returns
composer item at position

Definition at line 531 of file qgscomposition.cpp.

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.

Parameters
positionpoint to search for item at
belowItemitem to search below
ignoreLockedset to true to ignore locked items
Returns
composer item at position which is below specified item

Definition at line 536 of file qgscomposition.cpp.

template<class T >
void QgsComposition::composerItems ( QList< T * > &  itemList)

Return composer items of a specific type.

Parameters
itemListlist of item type to store matching items in
Note
not available in python bindings

Definition at line 904 of file qgscomposition.h.

template<class T >
void QgsComposition::composerItemsOnPage ( QList< T * > &  itemList,
const int  pageNumber 
) const

Return composer items of a specific type on a specified page.

Parameters
itemListlist of item type to store matching items in
pageNumberpage number (0 based)
Note
not available in python bindings
added in QGIS 2.5

Definition at line 919 of file qgscomposition.h.

void QgsComposition::composerLabelAdded ( QgsComposerLabel label)
signal

Is emitted when new composer label has been added to the view.

void QgsComposition::composerLegendAdded ( QgsComposerLegend legend)
signal

Is emitted when a new composer legend has been added.

void QgsComposition::composerMapAdded ( QgsComposerMap map)
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.

Note
available in python bindings only with PyQt >= 4.8.4

Definition at line 598 of file qgscomposition.cpp.

void QgsComposition::composerPictureAdded ( QgsComposerPicture picture)
signal

Is emitted when a new composer picture has been added.

void QgsComposition::composerScaleBarAdded ( QgsComposerScaleBar scalebar)
signal

Is emitted when new composer scale bar has been added.

void QgsComposition::composerShapeAdded ( QgsComposerShape shape)
signal

Is emitted when a new composer shape has been added.

void QgsComposition::composerTableAdded ( QgsComposerAttributeTable table)
signal

Is emitted when a new composer table has been added.

void QgsComposition::composerTableFrameAdded ( QgsComposerAttributeTableV2 table,
QgsComposerFrame frame 
)
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.

Definition at line 2827 of file qgscomposition.cpp.

QgsDataDefined * QgsComposition::dataDefinedProperty ( const QgsComposerObject::DataDefinedProperty  property)

Returns a reference to the data defined settings for one of the composition's data defined properties.

Parameters
propertydata defined property to return
Note
this method was added in version 2.5

Definition at line 2991 of file qgscomposition.cpp.

void QgsComposition::doPrint ( QPrinter printer,
QPainter painter,
bool  startNewPage = false 
)

Print on a preconfigured printer.

Parameters
printerQPrinter destination
painterQPainter source
startNewPageset to true to begin the print on a new page

Definition at line 2657 of file qgscomposition.cpp.

void QgsComposition::endCommand ( )

Saves end state of item and pushes command to the undo history.

Definition at line 2218 of file qgscomposition.cpp.

void QgsComposition::endMultiFrameCommand ( )

Definition at line 2263 of file qgscomposition.cpp.

bool QgsComposition::exportAsPDF ( const QString file)

Convenience function that prepares the printer for printing in PDF and prints.

Returns
true if export was successful

Definition at line 2650 of file qgscomposition.cpp.

bool QgsComposition::generateWorldFile ( ) const
inline

Definition at line 380 of file qgscomposition.h.

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).

Parameters
itemthe item.
Returns
QgsComposerHtml pointer or 0 pointer if no such item exists.

Definition at line 634 of file qgscomposition.cpp.

QgsComposerItem * QgsComposition::getComposerItemAbove ( QgsComposerItem item) const

Definition at line 1447 of file qgscomposition.cpp.

QgsComposerItem * QgsComposition::getComposerItemBelow ( QgsComposerItem item) const

Definition at line 1452 of file qgscomposition.cpp.

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.

Parameters
theId- A QString representing the identifier of the item to retrieve.
Returns
QgsComposerItem pointer or 0 pointer if no such item exists.

Definition at line 653 of file qgscomposition.cpp.

const QgsComposerItem * QgsComposition::getComposerItemByUuid ( const QString  theUuid) const

Returns a composer item given its unique identifier.

Parameters
theUuidA QString representing the UUID of the item to

Definition at line 708 of file qgscomposition.cpp.

const QgsComposerMap * QgsComposition::getComposerMapById ( const int  id) const

Returns the composer map with specified id.

Returns
QgsComposerMap or 0 pointer if the composer map item does not exist

Definition at line 616 of file qgscomposition.cpp.

const QPen& QgsComposition::gridPen ( ) const
inline

Definition at line 234 of file qgscomposition.h.

GridStyle QgsComposition::gridStyle ( ) const
inline

Definition at line 237 of file qgscomposition.h.

bool QgsComposition::gridVisible ( ) const
inline

Definition at line 209 of file qgscomposition.h.

QgsComposerItemGroup * QgsComposition::groupItems ( QList< QgsComposerItem * >  items)

Creates a new group from a list of composer items and adds it to the composition.

Parameters
itemsitems to include in group
Returns
QgsComposerItemGroup of grouped items, if grouping was possible
Note
added in QGIS 2.6

Definition at line 1797 of file qgscomposition.cpp.

void QgsComposition::init ( )
protected

Definition at line 77 of file qgscomposition.cpp.

int QgsComposition::itemPageNumber ( const QgsComposerItem item) const

Returns on which page number (0-based) is displayed an item.

Definition at line 574 of file qgscomposition.cpp.

void QgsComposition::itemRemoved ( QgsComposerItem )
signal

Is emitted when a composer item has been removed from the scene.

QgsComposerModel* QgsComposition::itemsModel ( )
inline

Returns the items model attached to the composition.

Returns
QgsComposerModel for composition
Note
this method was added in version 2.5

Definition at line 667 of file qgscomposition.h.

bool QgsComposition::loadFromTemplate ( const QDomDocument doc,
QMap< QString, QString > *  substitutionMap = 0,
bool  addUndoCommands = false,
const bool  clearComposition = true 
)

Load a template document.

Parameters
doctemplate document
substitutionMapmap with text to replace. Text needs to be enclosed by brackets (e.g. '[text]' )
addUndoCommandswhether or not to add undo commands
clearCompositionset 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.

Definition at line 925 of file qgscomposition.cpp.

void QgsComposition::lockSelectedItems ( )

Lock the selected items.

Definition at line 1750 of file qgscomposition.cpp.

bool QgsComposition::lowerItem ( QgsComposerItem item)

Definition at line 1515 of file qgscomposition.cpp.

void QgsComposition::lowerSelectedItems ( )

Definition at line 1494 of file qgscomposition.cpp.

Q_DECL_DEPRECATED QgsMapRenderer* QgsComposition::mapRenderer ( )
inline

Returns pointer to map renderer of qgis map canvas.

Deprecated:
since 2.4 - use mapSettings() instead. May return null if not initialized with QgsMapRenderer

Definition at line 393 of file qgscomposition.h.

const QgsMapSettings& QgsComposition::mapSettings ( ) const
inline

Return setting of QGIS map canvas.

Note
added in 2.4

Definition at line 397 of file qgscomposition.h.

bool QgsComposition::moveItemToBottom ( QgsComposerItem item)

Definition at line 1569 of file qgscomposition.cpp.

bool QgsComposition::moveItemToTop ( QgsComposerItem item)

Definition at line 1542 of file qgscomposition.cpp.

void QgsComposition::moveSelectedItemsToBottom ( )

Definition at line 1548 of file qgscomposition.cpp.

void QgsComposition::moveSelectedItemsToTop ( )

Definition at line 1521 of file qgscomposition.cpp.

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.

Note
not available in python bindings

Definition at line 1976 of file qgscomposition.cpp.

void QgsComposition::nPagesChanged ( )
signal
int QgsComposition::numPages ( ) const

Returns the number of pages in the composition.

Returns
number of pages
See Also
setNumPages

Definition at line 431 of file qgscomposition.cpp.

bool QgsComposition::pageIsEmpty ( const int  page) const

Returns whether a page is empty, ie, it contains no items except for the background paper item.

Parameters
pagepage number, starting with 1
Returns
true if page is empty
Note
added in QGIS 2.5
See Also
numPages
setNumPages
shouldExportPage

Definition at line 436 of file qgscomposition.cpp.

int QgsComposition::pageNumberAt ( const QPointF position) const

Returns the page number (0-based) given a coordinate.

Definition at line 569 of file qgscomposition.cpp.

int QgsComposition::pageNumberForPoint ( const QPointF position) const

Returns the page number corresponding to a point in the composition.

Note
Added in QGIS 2.1

Definition at line 518 of file qgscomposition.cpp.

QList< QgsPaperItem* > QgsComposition::pages ( )
inline

Return pages in the correct order.

Note
composerItems(QList< QgsPaperItem* > &) may not return pages in the correct order
added in version 2.4

Definition at line 645 of file qgscomposition.h.

QgsFillSymbolV2* QgsComposition::pageStyleSymbol ( )
inline

Note: added in version 2.1.

Definition at line 183 of file qgscomposition.h.

double QgsComposition::paperHeight ( ) const

Height of paper item.

Returns
height in mm
See Also
paperWidth
setPaperSize

Definition at line 362 of file qgscomposition.cpp.

void QgsComposition::paperSizeChanged ( )
signal
double QgsComposition::paperWidth ( ) const

Width of paper item.

Returns
width in mm
See Also
paperHeight
setPaperSize

Definition at line 367 of file qgscomposition.cpp.

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

Deprecated:
use QgsComposerUtils::pointsToMM instead

Definition at line 751 of file qgscomposition.cpp.

QgsComposition::PlotStyle QgsComposition::plotStyle ( ) const
inline

Definition at line 399 of file qgscomposition.h.

double QgsComposition::pointFontSize ( int  pixelSize) const

Does the inverse calculation and returns points for mm.

Deprecated:
use QgsComposerUtils::mmToPoints instead

Definition at line 756 of file qgscomposition.cpp.

QPointF QgsComposition::positionOnPage ( const QPointF position) const

Returns the position within a page of a point in the composition.

Note
Added in QGIS 2.1

Definition at line 501 of file qgscomposition.cpp.

bool QgsComposition::preventCursorChange ( ) const
inline

Definition at line 579 of file qgscomposition.h.

bool QgsComposition::print ( QPrinter printer,
const bool  evaluateDDPageSize = false 
)

Convenience function that prepares the printer and prints.

Returns
true if print was successful

Definition at line 2735 of file qgscomposition.cpp.

bool QgsComposition::printAsRaster ( ) const
inline

Definition at line 377 of file qgscomposition.h.

QImage QgsComposition::printPageAsRaster ( int  page)

print composer page to image If the image does not fit into memory, a null image is returned

Definition at line 2750 of file qgscomposition.cpp.

int QgsComposition::printResolution ( ) const
inline

Definition at line 374 of file qgscomposition.h.

void QgsComposition::printResolutionChanged ( )
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.

Definition at line 2487 of file qgscomposition.cpp.

bool QgsComposition::raiseItem ( QgsComposerItem item)

Definition at line 1441 of file qgscomposition.cpp.

void QgsComposition::raiseSelectedItems ( )

Definition at line 1420 of file qgscomposition.cpp.

bool QgsComposition::readXML ( const QDomElement compositionElem,
const QDomDocument doc 
)

Reads settings from xml file.

Definition at line 853 of file qgscomposition.cpp.

void QgsComposition::refreshDataDefinedProperty ( const QgsComposerObject::DataDefinedProperty  property = QgsComposerObject::AllProperties)
slot

Refreshes a data defined property for the composition by reevaluating the property's value and redrawing the composition with this new value.

Parameters
propertydata defined property to refresh. If property is set to QgsComposerItem::AllProperties then all data defined properties for the composition will be refreshed.
Note
this method was added in version 2.5

Definition at line 268 of file qgscomposition.cpp.

void QgsComposition::refreshItems ( )
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.

Note
added in version 2.3

Definition at line 225 of file qgscomposition.cpp.

void QgsComposition::refreshItemsTriggered ( )
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.

Definition at line 1878 of file qgscomposition.cpp.

double QgsComposition::relativePosition ( double  position,
double  beforeMin,
double  beforeMax,
double  afterMin,
double  afterMax 
)
static

Returns a scaled position given a before and after range.

Deprecated:
use QgsComposerUtils::relativePosition instead

Definition at line 3208 of file qgscomposition.cpp.

void QgsComposition::relativeResizeRect ( QRectF rectToResize,
const QRectF boundsBefore,
const QRectF boundsAfter 
)
static

Resizes a QRectF relative to the change from boundsBefore to boundsAfter.

Deprecated:
use QgsComposerUtils::relativeResizeRect instead

Definition at line 3203 of file qgscomposition.cpp.

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

Definition at line 2411 of file qgscomposition.cpp.

void QgsComposition::removeItemFromZList ( QgsComposerItem item)

Removes item from z list.

Usually called from destructor of QgsComposerItem

Definition at line 1409 of file qgscomposition.cpp.

void QgsComposition::removeMultiFrame ( QgsComposerMultiFrame multiFrame)

Removes multi frame (but does not delete it)

Definition at line 2294 of file qgscomposition.cpp.

void QgsComposition::removeSnapLine ( QGraphicsLineItem line)

Remove custom snap line (and delete the object)

Definition at line 1941 of file qgscomposition.cpp.

void QgsComposition::renderPage ( QPainter p,
int  page 
)

Render a page to a paint device.

Parameters
pdestination painter
pagepage number, 0 based such that the first page is page 0

Definition at line 2768 of file qgscomposition.cpp.

QList< QgsComposerItem * > QgsComposition::selectedComposerItems ( const bool  includeLockedItems = true)

Returns list of selected composer items.

Parameters
includeLockedItemsset to true to include locked items in list
Returns
list of selected items

Definition at line 579 of file qgscomposition.cpp.

void QgsComposition::selectedItemChanged ( QgsComposerItem selected)
signal

Is emitted when selected item changed.

If 0, no item is selected

QgsComposerMouseHandles* QgsComposition::selectionHandles ( )
inline

Returns pointer to selection handles.

Note
not available in python bindings

Definition at line 517 of file qgscomposition.h.

void QgsComposition::selectNextByZOrder ( const ZValueDirection  direction)

Definition at line 1457 of file qgscomposition.cpp.

void QgsComposition::sendItemAddedSignal ( QgsComposerItem item)
slot

Casts object to the proper subclass type and calls corresponding itemAdded signal.

Definition at line 2506 of file qgscomposition.cpp.

void QgsComposition::setAlignmentSnap ( const bool  s)
inline

Definition at line 215 of file qgscomposition.h.

Q_DECL_DEPRECATED void QgsComposition::setAlignmentSnapTolerance ( double  t)
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.

Parameters
tsnap tolerance in pixels
See Also
alignmentSnapTolerance
Deprecated:
Use setSnapTolerance instead

Definition at line 261 of file qgscomposition.h.

void QgsComposition::setAllUnselected ( )
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.

Note
added in version 2.5

Definition at line 249 of file qgscomposition.cpp.

bool QgsComposition::setAtlasMode ( const QgsComposition::AtlasMode  mode)

Sets the current atlas mode of the composition.

Parameters
modeatlas mode to switch to
Returns
false if the mode could not be changed.
See Also
atlasMode

Definition at line 2889 of file qgscomposition.cpp.

void QgsComposition::setBoundingBoxesVisible ( const bool  boundsVisible)

Sets whether selection bounding boxes should be shown in the composition.

Parameters
boundsVisibleset to true to show selection bounding box
See Also
boundingBoxesVisible
Note
added in QGIS 2.7

Definition at line 2148 of file qgscomposition.cpp.

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.

Parameters
propertydata defined property to set
activetrue if data defined property is active, false if it is disabled
useExpressiontrue if the expression should be used
expressionexpression for data defined property
fieldfield name if the data defined property should take its value from a field
Note
this method was added in version 2.5

Definition at line 3010 of file qgscomposition.cpp.

void QgsComposition::setGenerateWorldFile ( const bool  enabled)
inline

Definition at line 381 of file qgscomposition.h.

void QgsComposition::setGridPen ( const QPen p)

Definition at line 2134 of file qgscomposition.cpp.

void QgsComposition::setGridStyle ( const GridStyle  s)

Definition at line 2142 of file qgscomposition.cpp.

void QgsComposition::setGridVisible ( const bool  b)

Definition at line 2110 of file qgscomposition.cpp.

void QgsComposition::setNumPages ( const int  pages)

Sets the number of pages for the composition.

Parameters
pagesnumber of pages
See Also
numPages

Definition at line 372 of file qgscomposition.cpp.

void QgsComposition::setPageStyleSymbol ( QgsFillSymbolV2 symbol)

Note: added in version 2.1.

Definition at line 483 of file qgscomposition.cpp.

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.

Parameters
widthpage width in mm
heightpage height in mm
See Also
paperHeight
paperWidth

Definition at line 308 of file qgscomposition.cpp.

void QgsComposition::setPlotStyle ( const QgsComposition::PlotStyle  style)
inline

Definition at line 400 of file qgscomposition.h.

void QgsComposition::setPreventCursorChange ( const bool  preventChange)
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.

Definition at line 578 of file qgscomposition.h.

void QgsComposition::setPrintAsRaster ( const bool  enabled)
inline

Definition at line 378 of file qgscomposition.h.

void QgsComposition::setPrintResolution ( const int  dpi)

Definition at line 727 of file qgscomposition.cpp.

void QgsComposition::setSelectedItem ( QgsComposerItem item)
slot

Clears any selected items and sets an item as the current selection.

Parameters
itemitem to set as selected
Note
added in version 2.3

Definition at line 239 of file qgscomposition.cpp.

void QgsComposition::setSmartGuidesEnabled ( const bool  b)
inline

Definition at line 218 of file qgscomposition.h.

void QgsComposition::setSnapGridOffsetX ( const double  offset)

Definition at line 2122 of file qgscomposition.cpp.

void QgsComposition::setSnapGridOffsetY ( const double  offset)

Definition at line 2128 of file qgscomposition.cpp.

void QgsComposition::setSnapGridResolution ( const double  r)

Definition at line 2116 of file qgscomposition.cpp.

Q_DECL_DEPRECATED void QgsComposition::setSnapGridTolerance ( double  tolerance)
inline

Sets the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.

Parameters
tolerancesnap tolerance in pixels
See Also
snapGridTolerance
Deprecated:
Use setSnapTolerance instead

Definition at line 245 of file qgscomposition.h.

void QgsComposition::setSnapLinesVisible ( const bool  visible)

Hides / shows custom snap lines.

Definition at line 1959 of file qgscomposition.cpp.

void QgsComposition::setSnapToGridEnabled ( const bool  b)

Definition at line 2104 of file qgscomposition.cpp.

void QgsComposition::setSnapTolerance ( const int  snapTolerance)
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.

Parameters
snapTolerancesnap tolerance in pixels
See Also
alignmentSnapTolerance
Note
Added in QGIS 2.5

Definition at line 277 of file qgscomposition.h.

void QgsComposition::setStatusMessage ( const QString message)

Sets the status bar message for the composer window.

Note
Added in QGIS 2.1

Definition at line 526 of file qgscomposition.cpp.

void QgsComposition::setUseAdvancedEffects ( const bool  effectsEnabled)

Used to enable or disable advanced effects such as blend modes in a composition.

Definition at line 734 of file qgscomposition.cpp.

void QgsComposition::setWorldFileMap ( QgsComposerMap map)
inline

Definition at line 384 of file qgscomposition.h.

bool QgsComposition::shouldExportPage ( const int  page) const

Returns whether a specified page number should be included in exports of the composition.

Parameters
pagepage number, starting with 1
Returns
true if page should be exported
Note
added in QGIS 2.5
See Also
numPages
pageIsEmpty

Definition at line 459 of file qgscomposition.cpp.

bool QgsComposition::smartGuidesEnabled ( ) const
inline

Definition at line 219 of file qgscomposition.h.

double QgsComposition::snapGridOffsetX ( ) const
inline

Definition at line 228 of file qgscomposition.h.

double QgsComposition::snapGridOffsetY ( ) const
inline

Definition at line 231 of file qgscomposition.h.

double QgsComposition::snapGridResolution ( ) const
inline

Definition at line 225 of file qgscomposition.h.

Q_DECL_DEPRECATED double QgsComposition::snapGridTolerance ( ) const
inline

Returns the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.

Returns
snap tolerance in pixels
See Also
setSnapGridTolerance
Deprecated:
Use snapTolerance instead

Definition at line 253 of file qgscomposition.h.

QList< QGraphicsLineItem* >* QgsComposition::snapLines ( )
inline

Returns pointer to snap lines collection.

Definition at line 512 of file qgscomposition.h.

bool QgsComposition::snapLinesVisible ( ) const
inline

Definition at line 213 of file qgscomposition.h.

QPointF QgsComposition::snapPointToGrid ( const QPointF scenePoint) const

Snaps a scene coordinate point to grid.

Definition at line 1888 of file qgscomposition.cpp.

bool QgsComposition::snapToGridEnabled ( ) const
inline

Definition at line 206 of file qgscomposition.h.

int QgsComposition::snapTolerance ( ) const
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.

Returns
snap tolerance in pixels
See Also
setAlignmentSnapTolerance
Note
Added in QGIS 2.5

Definition at line 285 of file qgscomposition.h.

Q_DECL_DEPRECATED void QgsComposition::sortZList ( )
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

Deprecated:
use refreshZList instead

Definition at line 501 of file qgscomposition.h.

double QgsComposition::spaceBetweenPages ( ) const
inline

Returns the vertical space between pages in a composer view.

Returns
space between pages in mm

Definition at line 146 of file qgscomposition.h.

void QgsComposition::statusMsgChanged ( QString  message)
signal

Is emitted when the composition has an updated status bar message for the composer window.

QUndoStack* QgsComposition::undoStack ( )
inline

Returns pointer to undo/redo command storage.

Definition at line 302 of file qgscomposition.h.

QList< QgsComposerItem * > QgsComposition::ungroupItems ( QgsComposerItemGroup group)

Ungroups items by removing them from an item group and removing the group from the composition.

Parameters
groupitem group to ungroup
Returns
list of items removed from the group, or an empty list if ungrouping was not successful
Note
added in QGIS 2.6

Definition at line 1817 of file qgscomposition.cpp.

void QgsComposition::unlockAllItems ( )

Unlock all items.

Definition at line 1768 of file qgscomposition.cpp.

void QgsComposition::updateBounds ( )
slot

Updates the scene bounds of the composition.

Note
added in version 2.2

Definition at line 220 of file qgscomposition.cpp.

void QgsComposition::updateSettings ( )

Refreshes the composition when composer related options change.

Note
added in version 2.1

Definition at line 2158 of file qgscomposition.cpp.

bool QgsComposition::useAdvancedEffects ( ) const
inline

Returns true if a composition should use advanced effects such as blend modes.

Definition at line 387 of file qgscomposition.h.

QgsComposerMap* QgsComposition::worldFileMap ( ) const
inline

Definition at line 383 of file qgscomposition.h.

bool QgsComposition::writeXML ( QDomElement composerElem,
QDomDocument doc 
)

Writes settings to xml (paper dimension)

Definition at line 761 of file qgscomposition.cpp.

Friends And Related Function Documentation

friend class QgsComposerModel
friend

Definition at line 901 of file qgscomposition.h.

friend class QgsComposerObject
friend

Definition at line 900 of file qgscomposition.h.


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