QGIS API Documentation
2.14.0-Essen
|
Graphics scene for map printing. More...
#include <qgscomposition.h>
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 | |
QgsExpressionContext * | createExpressionContext () const |
Creates an expression context relating to the compositions's current state. More... | |
void | refreshDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties, const QgsExpressionContext *context=nullptr) |
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 (const 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=nullptr, bool addUndoCommands=false, QPointF *pos=nullptr, 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... | |
QGraphicsLineItem * | addSnapLine () |
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 () |
QgsAtlasComposition & | atlasComposition () |
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... | |
QgsComposerItem * | composerItemAt (QPointF position, const bool ignoreLocked=false) const |
Returns the topmost composer item at a specified position. More... | |
QgsComposerItem * | composerItemAt (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... | |
QRectF | compositionBounds (bool ignorePages=false, double margin=0.0) const |
Calculates the bounds of all non-gui items in the composition. More... | |
void | computeWorldFileParameters (double &a, double &b, double &c, double &d, double &e, double &f) const |
Compute world file parameters. More... | |
void | computeWorldFileParameters (const QRectF &exportRegion, double &a, double &b, double &c, double &d, double &e, double &f) const |
Computes the world file parameters for a specified region of the composition. More... | |
QStringList | customProperties () const |
Return list of keys stored in custom properties for composition. More... | |
QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
Read a custom property from the composition. More... | |
QgsDataDefined * | dataDefinedProperty (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... | |
QgsComposerItem * | getComposerItemAbove (QgsComposerItem *item) const |
QgsComposerItem * | getComposerItemBelow (QgsComposerItem *item) const |
const QgsComposerItem * | getComposerItemById (const QString &theId) const |
Returns a composer item given its text identifier. More... | |
const QgsComposerItem * | getComposerItemByUuid (const QString &theUuid) const |
Returns a composer item given its unique identifier. More... | |
const QgsComposerMap * | getComposerMapById (const int id) const |
Returns the composer map with specified id. More... | |
const QPen & | gridPen () const |
GridStyle | gridStyle () const |
bool | gridVisible () const |
QgsComposerItemGroup * | groupItems (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... | |
QgsComposerModel * | itemsModel () |
Returns the items model attached to the composition. More... | |
bool | loadFromTemplate (const QDomDocument &doc, QMap< QString, QString > *substitutionMap=nullptr, 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 QgsMapRenderer * | mapRenderer () |
Returns pointer to map renderer of qgis map canvas. More... | |
const QgsMapSettings & | mapSettings () const |
Return setting of QGIS map canvas. More... | |
bool | moveItemToBottom (QgsComposerItem *item) |
bool | moveItemToTop (QgsComposerItem *item) |
void | moveSelectedItemsToBottom () |
void | moveSelectedItemsToTop () |
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. 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... | |
QRectF | pageItemBounds (int pageNumber, bool visibleOnly=false) const |
Returns the bounding box of the items contained on a specified page. More... | |
int | pageNumberAt (QPointF position) const |
Returns the page number (0-based) given a coordinate. More... | |
int | pageNumberForPoint (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... | |
QgsFillSymbolV2 * | pageStyleSymbol () |
Note: added in version 2.1. More... | |
bool | pagesVisible () const |
Returns whether the page items are be visible in the composition. 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 (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, QSize imageSize=QSize(), int dpi=0) |
Renders a composer page to an image. 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 | removeCustomProperty (const QString &key) |
Remove a custom property from the composition. 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) |
Renders a full page to a paint device. More... | |
void | renderRect (QPainter *p, const QRectF &rect) |
Renders a portion of the composition to a paint device. More... | |
QImage | renderRectAsRaster (const QRectF &rect, QSize imageSize=QSize(), int dpi=0) |
Renders a portion of the composition to an image. More... | |
void | resizePageToContents (double marginTop=0.0, double marginRight=0.0, double marginBottom=0.0, double marginLeft=0.0) |
Resizes the composition page to fit the current contents of the composition. More... | |
void | resizeToContentsMargins (double &marginTop, double &marginRight, double &marginBottom, double &marginLeft) const |
Returns the resize to contents margins. More... | |
QList< QgsComposerItem * > | selectedComposerItems (const bool includeLockedItems=true) |
Returns list of selected composer items. More... | |
QgsComposerMouseHandles * | selectionHandles () |
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 | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for 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 | setPagesVisible (bool visible) |
Sets whether the page items should be visible in the composition. More... | |
void | setPaperSize (double width, double height, bool keepRelativeItemPosition=true) |
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 | setResizeToContentsMargins (double marginTop, double marginRight, double marginBottom, double marginLeft) |
Sets the resize to contents margins. More... | |
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 (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... | |
QUndoStack * | undoStack () |
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... | |
QgsComposerMap * | worldFileMap () 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 () |
QGraphicsItem * | activePanel () const |
QGraphicsWidget * | activeWindow () const |
QGraphicsEllipseItem * | addEllipse (const QRectF &rect, const QPen &pen, const QBrush &brush) |
QGraphicsEllipseItem * | addEllipse (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) |
void | addItem (QGraphicsItem *item) |
QGraphicsLineItem * | addLine (const QLineF &line, const QPen &pen) |
QGraphicsLineItem * | addLine (qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen) |
QGraphicsPathItem * | addPath (const QPainterPath &path, const QPen &pen, const QBrush &brush) |
QGraphicsPixmapItem * | addPixmap (const QPixmap &pixmap) |
QGraphicsPolygonItem * | addPolygon (const QPolygonF &polygon, const QPen &pen, const QBrush &brush) |
QGraphicsRectItem * | addRect (const QRectF &rect, const QPen &pen, const QBrush &brush) |
QGraphicsRectItem * | addRect (qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) |
QGraphicsSimpleTextItem * | addSimpleText (const QString &text, const QFont &font) |
QGraphicsTextItem * | addText (const QString &text, const QFont &font) |
QGraphicsProxyWidget * | addWidget (QWidget *widget, QFlags< Qt::WindowType > wFlags) |
void | advance () |
QBrush | backgroundBrush () const |
int | bspTreeDepth () const |
void | changed (const QList< QRectF > ®ion) |
void | clear () |
void | clearFocus () |
void | clearSelection () |
QList< QGraphicsItem * > | collidingItems (const QGraphicsItem *item, Qt::ItemSelectionMode mode) const |
QGraphicsItemGroup * | createItemGroup (const QList< QGraphicsItem * > &items) |
void | destroyItemGroup (QGraphicsItemGroup *group) |
QGraphicsItem * | focusItem () 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 |
QGraphicsItem * | itemAt (qreal x, qreal y) const |
QGraphicsItem * | itemAt (qreal x, qreal y, const QTransform &deviceTransform) const |
QGraphicsItem * | itemAt (const QPointF &position) const |
QGraphicsItem * | itemAt (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 |
QGraphicsItem * | mouseGrabberItem () 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 |
QStyle * | style () 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) |
QObject * | child (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< QByteArray > | dynamicPropertyNames () const |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) 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 QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () 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) |
QThread * | thread () 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 |
QObject * | sender () 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 | |
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 74 of file qgscomposition.h.
Composition atlas modes.
Enumerator | |
---|---|
AtlasOff | |
PreviewAtlas | |
ExportAtlas |
Definition at line 112 of file qgscomposition.h.
Style to draw the snapping grid.
Enumerator | |
---|---|
Solid | |
Dots | |
Crosses |
Definition at line 88 of file qgscomposition.h.
Enumerator | |
---|---|
Portrait | |
Landscape |
Definition at line 101 of file qgscomposition.h.
Enumerator | |
---|---|
ZValueBelow | |
ZValueAbove |
Definition at line 95 of file qgscomposition.h.
QgsComposition::QgsComposition | ( | QgsMapRenderer * | mapRenderer | ) |
Definition at line 59 of file qgscomposition.cpp.
|
explicit |
Definition at line 68 of file qgscomposition.cpp.
QgsComposition::~QgsComposition | ( | ) |
Definition at line 191 of file qgscomposition.cpp.
void QgsComposition::addComposerArrow | ( | QgsComposerArrow * | arrow | ) |
Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)
Definition at line 2435 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 2525 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 2445 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 2485 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 2455 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 2495 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 2475 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 2505 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 2515 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 2535 of file qgscomposition.cpp.
void QgsComposition::addItemsFromXML | ( | const QDomElement & | elem, |
const QDomDocument & | doc, | ||
QMap< QgsComposerMap *, int > * | mapsToRestore = nullptr , |
||
bool | addUndoCommands = false , |
||
QPointF * | pos = nullptr , |
||
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) |
Definition at line 1184 of file qgscomposition.cpp.
void QgsComposition::addItemToZList | ( | QgsComposerItem * | item | ) |
Adds item to z list.
Usually called from constructor of QgsComposerItem
Definition at line 1535 of file qgscomposition.cpp.
void QgsComposition::addMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Adds multiframe.
The object is owned by QgsComposition until removeMultiFrame is called
Definition at line 2421 of file qgscomposition.cpp.
QGraphicsLineItem * QgsComposition::addSnapLine | ( | ) |
Add a custom snap line (can be horizontal or vertical)
Definition at line 2062 of file qgscomposition.cpp.
|
inline |
Definition at line 261 of file qgscomposition.h.
|
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.
Definition at line 331 of file qgscomposition.h.
void QgsComposition::alignSelectedItemsBottom | ( | ) |
Definition at line 1859 of file qgscomposition.cpp.
void QgsComposition::alignSelectedItemsHCenter | ( | ) |
Definition at line 1742 of file qgscomposition.cpp.
void QgsComposition::alignSelectedItemsLeft | ( | ) |
Definition at line 1712 of file qgscomposition.cpp.
void QgsComposition::alignSelectedItemsRight | ( | ) |
Definition at line 1772 of file qgscomposition.cpp.
void QgsComposition::alignSelectedItemsTop | ( | ) |
Definition at line 1802 of file qgscomposition.cpp.
void QgsComposition::alignSelectedItemsVCenter | ( | ) |
Definition at line 1831 of file qgscomposition.cpp.
|
inline |
Definition at line 733 of file qgscomposition.h.
|
inline |
Returns the current atlas mode of the composition.
Definition at line 749 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.
item | target item |
commandText | descriptive command text |
c | context for merge commands (unknown for non-mergeable commands) |
Definition at line 2332 of file qgscomposition.cpp.
void QgsComposition::beginMultiFrameCommand | ( | QgsComposerMultiFrame * | multiFrame, |
const QString & | text, | ||
const QgsComposerMultiFrameMergeCommand::Context | c = QgsComposerMultiFrameMergeCommand::Unknown |
||
) |
Definition at line 2376 of file qgscomposition.cpp.
void QgsComposition::beginPrint | ( | QPrinter & | printer, |
const bool | evaluateDDPageSize = false |
||
) |
Prepare the printer for printing.
Definition at line 2841 of file qgscomposition.cpp.
Prepare the printer for printing in a PDF.
Definition at line 2752 of file qgscomposition.cpp.
|
inline |
Returns whether selection bounding boxes should be shown in the composition.
Definition at line 361 of file qgscomposition.h.
void QgsComposition::cancelCommand | ( | ) |
Deletes current command.
Definition at line 2370 of file qgscomposition.cpp.
void QgsComposition::cancelMultiFrameCommand | ( | ) |
Deletes current multi frame command.
Definition at line 2415 of file qgscomposition.cpp.
void QgsComposition::clearSnapLines | ( | ) |
Removes all snap lines.
Definition at line 2085 of file qgscomposition.cpp.
|
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 | ( | 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 |
Definition at line 649 of file qgscomposition.cpp.
QgsComposerItem * QgsComposition::composerItemAt | ( | 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 |
Definition at line 654 of file qgscomposition.cpp.
void QgsComposition::composerItems | ( | QList< T * > & | itemList | ) |
Return composer items of a specific type.
itemList | list of item type to store matching items in |
Definition at line 1093 of file qgscomposition.h.
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) |
Definition at line 1108 of file qgscomposition.h.
|
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.
Definition at line 716 of file qgscomposition.cpp.
|
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.
QRectF QgsComposition::compositionBounds | ( | bool | ignorePages = false , |
double | margin = 0.0 |
||
) | const |
Calculates the bounds of all non-gui items in the composition.
Ignores snap lines and mouse handles.
ignorePages | set to true to ignore page items |
margin | optional marginal (in percent, eg 0.05 = 5% ) to add around items |
Definition at line 297 of file qgscomposition.cpp.
void QgsComposition::computeWorldFileParameters | ( | double & | a, |
double & | b, | ||
double & | c, | ||
double & | d, | ||
double & | e, | ||
double & | f | ||
) | const |
Compute world file parameters.
Assumes the whole page containing the associated map item will be exported.
Definition at line 3007 of file qgscomposition.cpp.
void QgsComposition::computeWorldFileParameters | ( | const QRectF & | exportRegion, |
double & | a, | ||
double & | b, | ||
double & | c, | ||
double & | d, | ||
double & | e, | ||
double & | f | ||
) | const |
Computes the world file parameters for a specified region of the composition.
exportRegion | region of the composition which will be associated with world file |
a | |
b | |
c | |
d | |
e | |
f |
Definition at line 3020 of file qgscomposition.cpp.
|
slot |
Creates an expression context relating to the compositions's current state.
The context includes scopes for global, project, composition and atlas properties.
Definition at line 3424 of file qgscomposition.cpp.
QStringList QgsComposition::customProperties | ( | ) | const |
Return list of keys stored in custom properties for composition.
Definition at line 3262 of file qgscomposition.cpp.
QVariant QgsComposition::customProperty | ( | const QString & | key, |
const QVariant & | defaultValue = QVariant() |
||
) | const |
Read a custom property from the composition.
key | property key |
defaultValue | default value to return if property with matching key does not exist |
Definition at line 3252 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.
property | data defined property to return |
Definition at line 3199 of file qgscomposition.cpp.
Print on a preconfigured printer.
printer | QPrinter destination |
painter | QPainter source |
startNewPage | set to true to begin the print on a new page |
Definition at line 2783 of file qgscomposition.cpp.
void QgsComposition::endCommand | ( | ) |
Saves end state of item and pushes command to the undo history.
Definition at line 2352 of file qgscomposition.cpp.
void QgsComposition::endMultiFrameCommand | ( | ) |
Definition at line 2397 of file qgscomposition.cpp.
bool QgsComposition::exportAsPDF | ( | const QString & | file | ) |
Convenience function that prepares the printer for printing in PDF and prints.
Definition at line 2776 of file qgscomposition.cpp.
|
inline |
Definition at line 443 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).
item | the item. |
Definition at line 752 of file qgscomposition.cpp.
QgsComposerItem * QgsComposition::getComposerItemAbove | ( | QgsComposerItem * | item | ) | const |
Definition at line 1584 of file qgscomposition.cpp.
QgsComposerItem * QgsComposition::getComposerItemBelow | ( | QgsComposerItem * | item | ) | const |
Definition at line 1589 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.
theId | - A QString representing the identifier of the item to retrieve. |
Definition at line 771 of file qgscomposition.cpp.
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 |
Definition at line 826 of file qgscomposition.cpp.
const QgsComposerMap * QgsComposition::getComposerMapById | ( | const int | id | ) | const |
Returns the composer map with specified id.
Definition at line 734 of file qgscomposition.cpp.
|
inline |
Definition at line 296 of file qgscomposition.h.
|
inline |
Definition at line 299 of file qgscomposition.h.
|
inline |
Definition at line 254 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.
items | items to include in group |
Definition at line 1934 of file qgscomposition.cpp.
|
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 692 of file qgscomposition.cpp.
|
signal |
Is emitted when a composer item has been removed from the scene.
|
inline |
Returns the items model attached to the composition.
Definition at line 784 of file qgscomposition.h.
bool QgsComposition::loadFromTemplate | ( | const QDomDocument & | doc, |
QMap< QString, QString > * | substitutionMap = nullptr , |
||
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. |
Definition at line 1062 of file qgscomposition.cpp.
void QgsComposition::lockSelectedItems | ( | ) |
Lock the selected items.
Definition at line 1887 of file qgscomposition.cpp.
bool QgsComposition::lowerItem | ( | QgsComposerItem * | item | ) |
Definition at line 1652 of file qgscomposition.cpp.
void QgsComposition::lowerSelectedItems | ( | ) |
Definition at line 1631 of file qgscomposition.cpp.
|
inline |
Returns pointer to map renderer of qgis map canvas.
Definition at line 456 of file qgscomposition.h.
|
inline |
Return setting of QGIS map canvas.
Definition at line 460 of file qgscomposition.h.
bool QgsComposition::moveItemToBottom | ( | QgsComposerItem * | item | ) |
Definition at line 1706 of file qgscomposition.cpp.
bool QgsComposition::moveItemToTop | ( | QgsComposerItem * | item | ) |
Definition at line 1679 of file qgscomposition.cpp.
void QgsComposition::moveSelectedItemsToBottom | ( | ) |
Definition at line 1685 of file qgscomposition.cpp.
void QgsComposition::moveSelectedItemsToTop | ( | ) |
Definition at line 1658 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.
Definition at line 2110 of file qgscomposition.cpp.
|
signal |
int QgsComposition::numPages | ( | ) | const |
Returns the number of pages in the composition.
Definition at line 549 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.
page | page number, starting with 1 |
Definition at line 554 of file qgscomposition.cpp.
QRectF QgsComposition::pageItemBounds | ( | int | pageNumber, |
bool | visibleOnly = false |
||
) | const |
Returns the bounding box of the items contained on a specified page.
pageNumber | page number, where 0 is the first page |
visibleOnly | set to true to only include visible items |
Definition at line 328 of file qgscomposition.cpp.
int QgsComposition::pageNumberAt | ( | QPointF | position | ) | const |
Returns the page number (0-based) given a coordinate.
Definition at line 687 of file qgscomposition.cpp.
int QgsComposition::pageNumberForPoint | ( | QPointF | position | ) | const |
Returns the page number corresponding to a point in the composition.
Definition at line 636 of file qgscomposition.cpp.
|
inline |
Return pages in the correct order.
Definition at line 762 of file qgscomposition.h.
|
inline |
Note: added in version 2.1.
Definition at line 228 of file qgscomposition.h.
|
inline |
Returns whether the page items are be visible in the composition.
This setting effects both display of the page boundaries in composer views and whether they will be rendered in composition exports.
Definition at line 281 of file qgscomposition.h.
double QgsComposition::paperHeight | ( | ) | const |
Height of paper item.
Definition at line 422 of file qgscomposition.cpp.
|
signal |
double QgsComposition::paperWidth | ( | ) | const |
Width of paper item.
Definition at line 427 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
Definition at line 869 of file qgscomposition.cpp.
|
inline |
Definition at line 462 of file qgscomposition.h.
double QgsComposition::pointFontSize | ( | int | pixelSize | ) | const |
Does the inverse calculation and returns points for mm.
Definition at line 874 of file qgscomposition.cpp.
Returns the position within a page of a point in the composition.
Definition at line 619 of file qgscomposition.cpp.
|
inline |
Definition at line 644 of file qgscomposition.h.
bool QgsComposition::print | ( | QPrinter & | printer, |
const bool | evaluateDDPageSize = false |
||
) |
Convenience function that prepares the printer and prints.
Definition at line 2861 of file qgscomposition.cpp.
|
inline |
Definition at line 440 of file qgscomposition.h.
Renders a composer page to an image.
page | page number, 0 based such that the first page is page 0 |
imageSize | optional target image size, in pixels. It is the caller's responsibility to ensure that the ratio of the target image size matches the ratio of the composition page size. |
dpi | optional dpi override, or 0 to use default composition print resolution. This parameter has no effect if imageSize is specified. |
Definition at line 2876 of file qgscomposition.cpp.
|
inline |
Definition at line 437 of file qgscomposition.h.
|
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 2621 of file qgscomposition.cpp.
bool QgsComposition::raiseItem | ( | QgsComposerItem * | item | ) |
Definition at line 1578 of file qgscomposition.cpp.
void QgsComposition::raiseSelectedItems | ( | ) |
Definition at line 1557 of file qgscomposition.cpp.
bool QgsComposition::readXML | ( | const QDomElement & | compositionElem, |
const QDomDocument & | doc | ||
) |
Reads settings from xml file.
Definition at line 981 of file qgscomposition.cpp.
|
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. |
context | expression context for evaluating data defined expressions |
Definition at line 274 of file qgscomposition.cpp.
|
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.
Definition at line 231 of file qgscomposition.cpp.
|
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 2015 of file qgscomposition.cpp.
|
static |
Returns a scaled position given a before and after range.
Definition at line 3448 of file qgscomposition.cpp.
|
static |
Resizes a QRectF relative to the change from boundsBefore to boundsAfter.
Definition at line 3443 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 2545 of file qgscomposition.cpp.
void QgsComposition::removeCustomProperty | ( | const QString & | key | ) |
Remove a custom property from the composition.
key | property key |
Definition at line 3257 of file qgscomposition.cpp.
void QgsComposition::removeItemFromZList | ( | QgsComposerItem * | item | ) |
Removes item from z list.
Usually called from destructor of QgsComposerItem
Definition at line 1546 of file qgscomposition.cpp.
void QgsComposition::removeMultiFrame | ( | QgsComposerMultiFrame * | multiFrame | ) |
Removes multi frame (but does not delete it)
Definition at line 2428 of file qgscomposition.cpp.
void QgsComposition::removeSnapLine | ( | QGraphicsLineItem * | line | ) |
Remove custom snap line (and delete the object)
Definition at line 2078 of file qgscomposition.cpp.
void QgsComposition::renderPage | ( | QPainter * | p, |
int | page | ||
) |
Renders a full page to a paint device.
p | destination painter |
page | page number, 0 based such that the first page is page 0 |
Definition at line 2944 of file qgscomposition.cpp.
Renders a portion of the composition to a paint device.
This method can be used to render sections of pages rather than full pages.
p | destination painter |
rect | region of composition to render |
Definition at line 2961 of file qgscomposition.cpp.
QImage QgsComposition::renderRectAsRaster | ( | const QRectF & | rect, |
QSize | imageSize = QSize() , |
||
int | dpi = 0 |
||
) |
Renders a portion of the composition to an image.
This method can be used to render sections of pages rather than full pages.
rect | region of composition to render |
imageSize | optional target image size, in pixels. It is the caller's responsibility to ensure that the ratio of the target image size matches the ratio of the specified region of the composition. |
dpi | optional dpi override, or 0 to use default composition print resolution. This parameter has no effect if imageSize is specified. |
Definition at line 2910 of file qgscomposition.cpp.
void QgsComposition::resizePageToContents | ( | double | marginTop = 0.0 , |
double | marginRight = 0.0 , |
||
double | marginBottom = 0.0 , |
||
double | marginLeft = 0.0 |
||
) |
Resizes the composition page to fit the current contents of the composition.
Calling this method resets the number of pages to 1, with the size set to the minimum size required to fit all existing composer items. Items will also be repositioned so that the new top-left bounds of the composition is at the point (marginLeft, marginTop). An optional margin can be specified.
marginTop | top margin (millimeters) |
marginRight | right margin (millimeters) |
marginBottom | bottom margin (millimeters) |
marginLeft | left margin (millimeters) |
Definition at line 432 of file qgscomposition.cpp.
void QgsComposition::resizeToContentsMargins | ( | double & | marginTop, |
double & | marginRight, | ||
double & | marginBottom, | ||
double & | marginLeft | ||
) | const |
Returns the resize to contents margins.
These margins are saved in the composition so that they can be restored with the composer.
marginTop | reference for top margin (millimeters) |
marginRight | reference for right margin (millimeters) |
marginBottom | reference for bottom margin (millimeters) |
marginLeft | reference for left margin (millimeters) |
Definition at line 484 of file qgscomposition.cpp.
QList< QgsComposerItem * > QgsComposition::selectedComposerItems | ( | const bool | includeLockedItems = true | ) |
Returns list of selected composer items.
includeLockedItems | set to true to include locked items in list |
Definition at line 697 of file qgscomposition.cpp.
|
signal |
Is emitted when selected item changed.
If 0, no item is selected
|
inline |
Returns pointer to selection handles.
Definition at line 580 of file qgscomposition.h.
void QgsComposition::selectNextByZOrder | ( | const ZValueDirection | direction | ) |
Definition at line 1594 of file qgscomposition.cpp.
|
slot |
Casts object to the proper subclass type and calls corresponding itemAdded signal.
Definition at line 2640 of file qgscomposition.cpp.
|
inline |
Definition at line 260 of file qgscomposition.h.
|
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 |
Definition at line 323 of file qgscomposition.h.
|
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.
Definition at line 255 of file qgscomposition.cpp.
bool QgsComposition::setAtlasMode | ( | const QgsComposition::AtlasMode | mode | ) |
Sets the current atlas mode of the composition.
mode | atlas mode to switch to |
Definition at line 3089 of file qgscomposition.cpp.
void QgsComposition::setBoundingBoxesVisible | ( | const bool | boundsVisible | ) |
Sets whether selection bounding boxes should be shown in the composition.
boundsVisible | set to true to show selection bounding box |
Definition at line 2282 of file qgscomposition.cpp.
Set a custom property for the composition.
key | property key. If a property with the same key already exists it will be overwritten. |
value | property value |
Definition at line 3247 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.
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 |
Definition at line 3218 of file qgscomposition.cpp.
|
inline |
Definition at line 444 of file qgscomposition.h.
void QgsComposition::setGridPen | ( | const QPen & | p | ) |
Definition at line 2268 of file qgscomposition.cpp.
void QgsComposition::setGridStyle | ( | const GridStyle | s | ) |
Definition at line 2276 of file qgscomposition.cpp.
void QgsComposition::setGridVisible | ( | const bool | b | ) |
Definition at line 2244 of file qgscomposition.cpp.
void QgsComposition::setNumPages | ( | const int | pages | ) |
Sets the number of pages for the composition.
pages | number of pages |
Definition at line 492 of file qgscomposition.cpp.
void QgsComposition::setPageStyleSymbol | ( | QgsFillSymbolV2 * | symbol | ) |
Note: added in version 2.1.
Definition at line 601 of file qgscomposition.cpp.
void QgsComposition::setPagesVisible | ( | bool | visible | ) |
Sets whether the page items should be visible in the composition.
Removing them will prevent both display of the page boundaries in composer views and will also prevent them from being rendered in composition exports.
visible | set to true to show pages, false to hide pages |
Definition at line 2104 of file qgscomposition.cpp.
void QgsComposition::setPaperSize | ( | double | width, |
double | height, | ||
bool | keepRelativeItemPosition = true |
||
) |
Changes size of paper item.
width | page width in mm |
height | page height in mm |
keepRelativeItemPosition | if true, all items and guides will be moved so that they retain their same relative position to the top left corner of their current page. |
Definition at line 356 of file qgscomposition.cpp.
|
inline |
Definition at line 463 of file qgscomposition.h.
|
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 643 of file qgscomposition.h.
|
inline |
Definition at line 441 of file qgscomposition.h.
void QgsComposition::setPrintResolution | ( | const int | dpi | ) |
Definition at line 845 of file qgscomposition.cpp.
void QgsComposition::setResizeToContentsMargins | ( | double | marginTop, |
double | marginRight, | ||
double | marginBottom, | ||
double | marginLeft | ||
) |
Sets the resize to contents margins.
These margins are saved in the composition so that they can be restored with the composer.
marginTop | top margin (millimeters) |
marginRight | right margin (millimeters) |
marginBottom | bottom margin (millimeters) |
marginLeft | left margin (millimeters) |
Definition at line 476 of file qgscomposition.cpp.
|
slot |
Clears any selected items and sets an item as the current selection.
item | item to set as selected |
Definition at line 245 of file qgscomposition.cpp.
|
inline |
Definition at line 263 of file qgscomposition.h.
void QgsComposition::setSnapGridOffsetX | ( | const double | offset | ) |
Definition at line 2256 of file qgscomposition.cpp.
void QgsComposition::setSnapGridOffsetY | ( | const double | offset | ) |
Definition at line 2262 of file qgscomposition.cpp.
void QgsComposition::setSnapGridResolution | ( | const double | r | ) |
Definition at line 2250 of file qgscomposition.cpp.
|
inline |
Sets the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.
tolerance | snap tolerance in pixels |
Definition at line 307 of file qgscomposition.h.
void QgsComposition::setSnapLinesVisible | ( | const bool | visible | ) |
Hides / shows custom snap lines.
Definition at line 2095 of file qgscomposition.cpp.
void QgsComposition::setSnapToGridEnabled | ( | const bool | b | ) |
Definition at line 2238 of file qgscomposition.cpp.
|
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 |
Definition at line 339 of file qgscomposition.h.
void QgsComposition::setStatusMessage | ( | const QString & | message | ) |
Sets the status bar message for the composer window.
Definition at line 644 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 852 of file qgscomposition.cpp.
|
inline |
Definition at line 447 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.
page | page number, starting with 1 |
Definition at line 577 of file qgscomposition.cpp.
|
inline |
Definition at line 264 of file qgscomposition.h.
|
inline |
Definition at line 290 of file qgscomposition.h.
|
inline |
Definition at line 293 of file qgscomposition.h.
|
inline |
Definition at line 287 of file qgscomposition.h.
|
inline |
Returns the snap tolerance to use when automatically snapping items during movement and resizing to the composition grid.
Definition at line 315 of file qgscomposition.h.
|
inline |
Returns pointer to snap lines collection.
Definition at line 575 of file qgscomposition.h.
|
inline |
Definition at line 258 of file qgscomposition.h.
Snaps a scene coordinate point to grid.
Definition at line 2025 of file qgscomposition.cpp.
|
inline |
Definition at line 251 of file qgscomposition.h.
|
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.
Definition at line 347 of file qgscomposition.h.
|
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
Definition at line 564 of file qgscomposition.h.
|
inline |
Returns the vertical space between pages in a composer view.
Definition at line 191 of file qgscomposition.h.
|
signal |
Is emitted when the composition has an updated status bar message for the composer window.
|
inline |
Returns pointer to undo/redo command storage.
Definition at line 364 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.
group | item group to ungroup |
Definition at line 1954 of file qgscomposition.cpp.
void QgsComposition::unlockAllItems | ( | ) |
Unlock all items.
Definition at line 1905 of file qgscomposition.cpp.
|
slot |
Updates the scene bounds of the composition.
Definition at line 226 of file qgscomposition.cpp.
void QgsComposition::updateSettings | ( | ) |
Refreshes the composition when composer related options change.
Definition at line 2292 of file qgscomposition.cpp.
|
inline |
Returns true if a composition should use advanced effects such as blend modes.
Definition at line 450 of file qgscomposition.h.
|
inline |
Definition at line 446 of file qgscomposition.h.
bool QgsComposition::writeXML | ( | QDomElement & | composerElem, |
QDomDocument & | doc | ||
) |
Writes settings to xml (paper dimension)
Definition at line 879 of file qgscomposition.cpp.
|
friend |
Definition at line 1090 of file qgscomposition.h.
|
friend |
Definition at line 1089 of file qgscomposition.h.