From b52f7c29759b0efb027f50bdf42ef9742f8b3e46 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Tue, 20 Jun 2017 11:14:25 +0200 Subject: [PATCH] sipify core composer part 2 --- python/auto_sip.blacklist | 13 - python/core/composer/qgscomposereffect.sip | 32 +- python/core/composer/qgscomposerframe.sip | 141 +- python/core/composer/qgscomposerhtml.sip | 336 +++-- python/core/composer/qgscomposeritem.sip | 1039 ++++++++------ .../core/composer/qgscomposeritemcommand.sip | 113 +- python/core/composer/qgscomposeritemgroup.sip | 98 +- python/core/composer/qgscomposerlabel.sip | 228 ++- python/core/composer/qgscomposerlegend.sip | 403 ++++-- python/core/composer/qgscomposermapgrid.sip | 1261 +++++++++-------- python/core/composer/qgscomposermapitem.sip | 359 +++-- .../core/composer/qgscomposermapoverview.sip | 364 +++-- python/core/composer/qgscomposermodel.sip | 484 ++++--- .../core/composer/qgscomposermultiframe.sip | 432 +++--- src/core/composer/qgscomposeritem.h | 3 +- src/core/composer/qgscomposermultiframe.h | 9 + 16 files changed, 3142 insertions(+), 2173 deletions(-) diff --git a/python/auto_sip.blacklist b/python/auto_sip.blacklist index 01f840fdd3d..4bec7d330c6 100644 --- a/python/auto_sip.blacklist +++ b/python/auto_sip.blacklist @@ -1,18 +1,5 @@ core/conversions.sip core/qgsexception.sip -core/composer/qgscomposereffect.sip -core/composer/qgscomposerframe.sip -core/composer/qgscomposerhtml.sip -core/composer/qgscomposeritem.sip -core/composer/qgscomposeritemcommand.sip -core/composer/qgscomposeritemgroup.sip -core/composer/qgscomposerlabel.sip -core/composer/qgscomposerlegend.sip -core/composer/qgscomposermapgrid.sip -core/composer/qgscomposermapitem.sip -core/composer/qgscomposermapoverview.sip -core/composer/qgscomposermodel.sip -core/composer/qgscomposermultiframe.sip core/composer/qgscomposermultiframecommand.sip core/composer/qgscomposerobject.sip core/composer/qgscomposerpicture.sip diff --git a/python/core/composer/qgscomposereffect.sip b/python/core/composer/qgscomposereffect.sip index 200ace8413e..9b1c47467f7 100644 --- a/python/core/composer/qgscomposereffect.sip +++ b/python/core/composer/qgscomposereffect.sip @@ -1,15 +1,39 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposereffect.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + class QgsComposerEffect : QGraphicsEffect { + %TypeHeaderCode -#include +#include "qgscomposereffect.h" %End public: QgsComposerEffect(); - ~QgsComposerEffect(); - void setCompositionMode( const QPainter::CompositionMode &compositionMode ); + void setCompositionMode( QPainter::CompositionMode compositionMode ); protected: - /** Called whenever source needs to be drawn */ virtual void draw( QPainter *painter ); +%Docstring +Called whenever source needs to be drawn +%End + }; + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposereffect.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposerframe.sip b/python/core/composer/qgscomposerframe.sip index ed78e03b9b3..f07d4479c22 100644 --- a/python/core/composer/qgscomposerframe.sip +++ b/python/core/composer/qgscomposerframe.sip @@ -1,82 +1,119 @@ -/** Frame item for a composer multiframe item*/ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerframe.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsComposerFrame: QgsComposerItem { +%Docstring + Frame item for a composer multiframe item. +%End + %TypeHeaderCode #include "qgscomposerframe.h" %End - public: QgsComposerFrame( QgsComposition *c /TransferThis/, QgsComposerMultiFrame *mf, qreal x, qreal y, qreal width, qreal height ); - ~QgsComposerFrame(); - - /** Sets the visible part of the multiframe's content which is visible within - * this frame (relative to the total multiframe extent in mm). - * @param section visible portion of content - * @see extent - */ void setContentSection( const QRectF §ion ); +%Docstring + Sets the visible part of the multiframe's content which is visible within + this frame (relative to the total multiframe extent in mm). + \param section visible portion of content +.. seealso:: extent +%End - /** Returns the parent multiframe for the frame. - * @returns parent multiframe - */ QgsComposerMultiFrame *multiFrame() const; +%Docstring + Returns the parent multiframe for the frame. + :return: parent multiframe + :rtype: QgsComposerMultiFrame +%End - //Overridden to allow multiframe to set display name virtual QString displayName() const; - //Overridden to handle fixed frame sizes set by multi frame - void setSceneRect( const QRectF &rectangle ); + virtual void setSceneRect( const QRectF &rectangle ); - void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); - void beginItemCommand( const QString &text ); - void endItemCommand(); - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); - int type() const; - /** Returns the visible portion of the multi frame's content which - * is shown in this frame. - * @returns extent of visible portion - * @note added in QGIS 2.5 - * @see setContentSection - */ + virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); + + virtual void beginItemCommand( const QString &text ); + + virtual void endItemCommand(); + + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + + virtual int type() const; + QRectF extent() const; +%Docstring + Returns the visible portion of the multi frame's content which + is shown in this frame. + :return: extent of visible portion +.. versionadded:: 2.5 +.. seealso:: setContentSection + :rtype: QRectF +%End - /** Returns whether the page should be hidden (ie, not included in composer exports) if this frame is empty - * @returns true if page should be hidden if frame is empty - * @note added in QGIS 2.5 - * @see setHidePageIfEmpty - */ bool hidePageIfEmpty() const; +%Docstring + Returns whether the page should be hidden (ie, not included in composer exports) if this frame is empty + :return: true if page should be hidden if frame is empty +.. versionadded:: 2.5 +.. seealso:: setHidePageIfEmpty + :rtype: bool +%End - /** Sets whether the page should be hidden (ie, not included in composer exports) if this frame is empty - * @param hidePageIfEmpty set to true if page should be hidden if frame is empty - * @note added in QGIS 2.5 - * @see hidePageIfEmpty - */ void setHidePageIfEmpty( const bool hidePageIfEmpty ); +%Docstring + Sets whether the page should be hidden (ie, not included in composer exports) if this frame is empty + \param hidePageIfEmpty set to true if page should be hidden if frame is empty +.. versionadded:: 2.5 +.. seealso:: hidePageIfEmpty +%End - /** Returns whether the background and frame border should be hidden if this frame is empty - * @returns true if background and border should be hidden if frame is empty - * @note added in QGIS 2.5 - * @see setHideBackgroundIfEmpty - */ bool hideBackgroundIfEmpty() const; +%Docstring + Returns whether the background and frame stroke should be hidden if this frame is empty + :return: true if background and stroke should be hidden if frame is empty +.. versionadded:: 2.5 +.. seealso:: setHideBackgroundIfEmpty + :rtype: bool +%End - /** Sets whether the background and frame border should be hidden if this frame is empty - * @param hideBackgroundIfEmpty set to true if background and border should be hidden if frame is empty - * @note added in QGIS 2.5 - * @see hideBackgroundIfEmpty - */ void setHideBackgroundIfEmpty( const bool hideBackgroundIfEmpty ); +%Docstring + Sets whether the background and frame stroke should be hidden if this frame is empty + \param hideBackgroundIfEmpty set to true if background and stroke should be hidden if frame is empty +.. versionadded:: 2.5 +.. seealso:: hideBackgroundIfEmpty +%End - /** Returns whether the frame is empty - * @returns true if frame is empty - * @note added in QGIS 2.5 - * @see hidePageIfEmpty - */ bool isEmpty() const; +%Docstring + Returns whether the frame is empty + :return: true if frame is empty +.. versionadded:: 2.5 +.. seealso:: hidePageIfEmpty + :rtype: bool +%End virtual QgsExpressionContext createExpressionContext() const; + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerframe.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposerhtml.sip b/python/core/composer/qgscomposerhtml.sip index 82bb9886e51..952b564a70f 100644 --- a/python/core/composer/qgscomposerhtml.sip +++ b/python/core/composer/qgscomposerhtml.sip @@ -1,200 +1,250 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerhtml.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsComposerHtml: QgsComposerMultiFrame { + %TypeHeaderCode #include "qgscomposerhtml.h" %End + public: - public: - - /** Source modes for the HTML content to render in the item - */ enum ContentMode { - Url, /*!< Using this mode item fetches its content via a url*/ - ManualHtml /*!< HTML content is manually set for the item*/ + Url, + ManualHtml }; QgsComposerHtml( QgsComposition *c /TransferThis/, bool createUndoCommands ); ~QgsComposerHtml(); - /** Sets the source mode for item's HTML content. - * @param mode ContentMode for the item's source - * @see contentMode - * @see setUrl - * @see setHtml - * @note added in 2.5 - */ void setContentMode( ContentMode mode ); +%Docstring + Sets the source mode for item's HTML content. + \param mode ContentMode for the item's source +.. seealso:: contentMode +.. seealso:: setUrl +.. seealso:: setHtml +.. versionadded:: 2.5 +%End - /** Returns the source mode for item's HTML content. - * @returns ContentMode for the item's source - * @see setContentMode - * @see url - * @see html - * @note added in 2.5 - */ ContentMode contentMode() const; +%Docstring + Returns the source mode for item's HTML content. + :return: ContentMode for the item's source +.. seealso:: setContentMode +.. seealso:: url +.. seealso:: html +.. versionadded:: 2.5 + :rtype: ContentMode +%End - /** Sets the URL for content to display in the item when the item is using - * the QgsComposerHtml::Url mode. Content is automatically fetched and the - * HTML item refreshed after calling this function. - * @param url URL of content to display in the item - * @see url - * @see contentMode - */ void setUrl( const QUrl &url ); +%Docstring + Sets the URL for content to display in the item when the item is using + the QgsComposerHtml.Url mode. Content is automatically fetched and the + HTML item refreshed after calling this function. + \param url URL of content to display in the item +.. seealso:: url +.. seealso:: contentMode +%End - /** Returns the URL of the content displayed in the item if the item is using - * the QgsComposerHtml::Url mode. - * @returns url for content displayed in item - * @see setUrl - * @see contentMode - */ QUrl url() const; +%Docstring + Returns the URL of the content displayed in the item if the item is using + the QgsComposerHtml.Url mode. + :return: url for content displayed in item +.. seealso:: setUrl +.. seealso:: contentMode + :rtype: QUrl +%End - /** Sets the HTML to display in the item when the item is using - * the QgsComposerHtml::ManualHtml mode. Setting the HTML using this function - * does not automatically refresh the item's contents. Call loadHtml to trigger - * a refresh of the item after setting the HTML content. - * @param html HTML to display in item - * @see html - * @see contentMode - * @see loadHtml - * @note added in 2.5 - */ void setHtml( const QString &html ); +%Docstring + Sets the HTML to display in the item when the item is using + the QgsComposerHtml.ManualHtml mode. Setting the HTML using this function + does not automatically refresh the item's contents. Call loadHtml to trigger + a refresh of the item after setting the HTML content. + \param html HTML to display in item +.. seealso:: html +.. seealso:: contentMode +.. seealso:: loadHtml +.. versionadded:: 2.5 +%End - /** Returns the HTML source displayed in the item if the item is using - * the QgsComposerHtml::ManualHtml mode. - * @returns HTML displayed in item - * @see setHtml - * @see contentMode - * @note added in 2.5 - */ QString html() const; +%Docstring + Returns the HTML source displayed in the item if the item is using + the QgsComposerHtml.ManualHtml mode. + :return: HTML displayed in item +.. seealso:: setHtml +.. seealso:: contentMode +.. versionadded:: 2.5 + :rtype: str +%End - /** Returns whether html item will evaluate QGIS expressions prior to rendering - * the HTML content. If set, any content inside [% %] tags will be - * treated as a QGIS expression and evaluated against the current atlas - * feature. - * @returns true if html item will evaluate expressions in the content - * @see setEvaluateExpressions - * @note added in QGIS 2.5 - */ bool evaluateExpressions() const; +%Docstring + Returns whether html item will evaluate QGIS expressions prior to rendering + the HTML content. If set, any content inside [% %] tags will be + treated as a QGIS expression and evaluated against the current atlas + feature. + :return: true if html item will evaluate expressions in the content +.. seealso:: setEvaluateExpressions +.. versionadded:: 2.5 + :rtype: bool +%End - /** Sets whether the html item will evaluate QGIS expressions prior to rendering - * the HTML content. If set, any content inside [% %] tags will be - * treated as a QGIS expression and evaluated against the current atlas - * feature. - * @param evaluateExpressions set to true to evaluate expressions in the HTML content - * @see evaluateExpressions - * @note added in QGIS 2.5 - */ void setEvaluateExpressions( bool evaluateExpressions ); +%Docstring + Sets whether the html item will evaluate QGIS expressions prior to rendering + the HTML content. If set, any content inside [% %] tags will be + treated as a QGIS expression and evaluated against the current atlas + feature. + \param evaluateExpressions set to true to evaluate expressions in the HTML content +.. seealso:: evaluateExpressions +.. versionadded:: 2.5 +%End - /** Returns whether html item is using smart breaks. Smart breaks prevent - * the html frame contents from breaking mid-way though a line of text. - * @returns true if html item is using smart breaks - * @see setUseSmartBreaks - */ bool useSmartBreaks() const; +%Docstring + Returns whether html item is using smart breaks. Smart breaks prevent + the html frame contents from breaking mid-way though a line of text. + :return: true if html item is using smart breaks +.. seealso:: setUseSmartBreaks + :rtype: bool +%End - /** Sets whether the html item should use smart breaks. Smart breaks prevent - * the html frame contents from breaking mid-way though a line of text. - * @param useSmartBreaks set to true to prevent content from breaking - * mid-way through a line of text - * @see useSmartBreaks - */ void setUseSmartBreaks( bool useSmartBreaks ); +%Docstring + Sets whether the html item should use smart breaks. Smart breaks prevent + the html frame contents from breaking mid-way though a line of text. + \param useSmartBreaks set to true to prevent content from breaking + mid-way through a line of text +.. seealso:: useSmartBreaks +%End - /** Sets the maximum distance allowed when calculating where to place page breaks - * in the html. This distance is the maximum amount of empty space allowed - * at the bottom of a frame after calculating the optimum break location. Setting - * a larger value will result in better choice of page break location, but more - * wasted space at the bottom of frames. This setting is only effective if - * useSmartBreaks is true. - * @param maxBreakDistance maximum amount of empty space to leave when calculating - * page break locations - * @note added in 2.3 - * @see maxBreakDistance - * @see setUseSmartBreaks - */ void setMaxBreakDistance( double maxBreakDistance ); +%Docstring + Sets the maximum distance allowed when calculating where to place page breaks + in the html. This distance is the maximum amount of empty space allowed + at the bottom of a frame after calculating the optimum break location. Setting + a larger value will result in better choice of page break location, but more + wasted space at the bottom of frames. This setting is only effective if + useSmartBreaks is true. + \param maxBreakDistance maximum amount of empty space to leave when calculating + page break locations +.. versionadded:: 2.3 +.. seealso:: maxBreakDistance +.. seealso:: setUseSmartBreaks +%End - /** Returns the maximum distance allowed when calculating where to place page breaks - * in the html. This distance is the maximum amount of empty space allowed - * at the bottom of a frame after calculating the optimum break location. This setting - * is only effective if useSmartBreaks is true. - * @returns maximum amount of empty space to leave when calculating page break locations - * @note added in 2.3 - * @see setMaxBreakDistance - * @see useSmartBreaks - */ double maxBreakDistance() const; +%Docstring + Returns the maximum distance allowed when calculating where to place page breaks + in the html. This distance is the maximum amount of empty space allowed + at the bottom of a frame after calculating the optimum break location. This setting + is only effective if useSmartBreaks is true. + :return: maximum amount of empty space to leave when calculating page break locations +.. versionadded:: 2.3 +.. seealso:: setMaxBreakDistance +.. seealso:: useSmartBreaks + :rtype: float +%End - /** Sets the user stylesheet CSS rules to use while rendering the HTML content. These - * allow for overriding the styles specified within the HTML source. Setting the stylesheet - * using this function does not automatically refresh the item's contents. Call loadHtml - * to trigger a refresh of the item after setting the stylesheet rules. - * @param stylesheet CSS rules for user stylesheet - * @see userStylesheet - * @see setUserStylesheetEnabled - * @see loadHtml - * @note added in 2.5 - */ void setUserStylesheet( const QString &stylesheet ); +%Docstring + Sets the user stylesheet CSS rules to use while rendering the HTML content. These + allow for overriding the styles specified within the HTML source. Setting the stylesheet + using this function does not automatically refresh the item's contents. Call loadHtml + to trigger a refresh of the item after setting the stylesheet rules. + \param stylesheet CSS rules for user stylesheet +.. seealso:: userStylesheet +.. seealso:: setUserStylesheetEnabled +.. seealso:: loadHtml +.. versionadded:: 2.5 +%End - /** Returns the user stylesheet CSS rules used while rendering the HTML content. These - * overriding the styles specified within the HTML source. - * @returns CSS rules for user stylesheet - * @see setUserStylesheet - * @see userStylesheetEnabled - * @note added in 2.5 - */ QString userStylesheet() const; +%Docstring + Returns the user stylesheet CSS rules used while rendering the HTML content. These + overriding the styles specified within the HTML source. + :return: CSS rules for user stylesheet +.. seealso:: setUserStylesheet +.. seealso:: userStylesheetEnabled +.. versionadded:: 2.5 + :rtype: str +%End - /** Sets whether user stylesheets are enabled for the HTML content. - * @param stylesheetEnabled set to true to enable user stylesheets - * @see userStylesheetEnabled - * @see setUserStylesheet - * @note added in 2.5 - */ void setUserStylesheetEnabled( const bool stylesheetEnabled ); +%Docstring + Sets whether user stylesheets are enabled for the HTML content. + \param stylesheetEnabled set to true to enable user stylesheets +.. seealso:: userStylesheetEnabled +.. seealso:: setUserStylesheet +.. versionadded:: 2.5 +%End - /** Returns whether user stylesheets are enabled for the HTML content. - * @returns true if user stylesheets are enabled - * @see setUserStylesheetEnabled - * @see userStylesheet - * @note added in 2.5 - */ bool userStylesheetEnabled() const; +%Docstring + Returns whether user stylesheets are enabled for the HTML content. + :return: true if user stylesheets are enabled +.. seealso:: setUserStylesheetEnabled +.. seealso:: userStylesheet +.. versionadded:: 2.5 + :rtype: bool +%End virtual QString displayName() const; - QSizeF totalSize() const; - void render( QPainter *p, const QRectF &renderExtent, const int frameIndex ); - bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const; - bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ); - void addFrame( QgsComposerFrame *frame /Transfer/, bool recalcFrameSizes = true ); - //overridden to break frames without dividing lines of text - double findNearbyPageBreak( double yPos ); + virtual QSizeF totalSize() const; + + virtual void render( QPainter *p, const QRectF &renderExtent, const int frameIndex ); + + virtual bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const; + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ); + + virtual void addFrame( QgsComposerFrame *frame /Transfer/, bool recalcFrameSizes = true ); + + virtual double findNearbyPageBreak( double yPos ); + public slots: - /** Reloads the html source from the url and redraws the item. - * @param useCache set to true to use a cached copy of remote html - * content - * @param context expression context for evaluating data defined urls and expressions in html - * @see setUrl - * @see url - */ void loadHtml( const bool useCache = false, const QgsExpressionContext *context = 0 ); +%Docstring + Reloads the html source from the url and redraws the item. + \param useCache set to true to use a cached copy of remote html + content + \param context expression context for evaluating data defined urls and expressions in html +.. seealso:: setUrl +.. seealso:: url +%End - /** Recalculates the frame sizes for the current viewport dimensions*/ - void recalculateFrameSizes(); + virtual void recalculateFrameSizes(); + +%Docstring +Recalculates the frame sizes for the current viewport dimensions +%End void refreshExpressionContext(); virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = 0 ); }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerhtml.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposeritem.sip b/python/core/composer/qgscomposeritem.sip index 955b669a257..8fdc073c13f 100644 --- a/python/core/composer/qgscomposeritem.sip +++ b/python/core/composer/qgscomposeritem.sip @@ -1,10 +1,23 @@ -/** \ingroup core - * A item that forms part of a map composition. - */ -class QgsComposerItem : QgsComposerObject, QGraphicsRectItem +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritem.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + +class QgsComposerItem: QgsComposerObject, QGraphicsRectItem { +%Docstring + A item that forms part of a map composition. +%End + %TypeHeaderCode -#include +#include "qgscomposeritem.h" + #include #include #include @@ -21,81 +34,80 @@ class QgsComposerItem : QgsComposerObject, QGraphicsRectItem %End %ConvertToSubClassCode - // the conversions have to be static, because they're using multiple inheritance - // (seen in PyQt4 .sip files for some QGraphicsItem classes) - switch (sipCpp->type()) - { - case QgsComposerItem::ComposerItem: - sipType = sipType_QgsComposerItem; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerArrow: - sipType = sipType_QgsComposerArrow; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerItemGroup: - sipType = sipType_QgsComposerItemGroup; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerLabel: - sipType = sipType_QgsComposerLabel; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerLegend: - sipType = sipType_QgsComposerLegend; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerMap: - sipType = sipType_QgsComposerMap; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerPaper: - sipType = sipType_QgsPaperItem; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerPicture: - sipType = sipType_QgsComposerPicture; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerScaleBar: - sipType = sipType_QgsComposerScaleBar; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerShape: - sipType = sipType_QgsComposerShape; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerPolygon: - sipType = sipType_QgsComposerPolygon; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerPolyline: - sipType = sipType_QgsComposerPolyline; - *sipCppRet = static_cast(sipCpp); - break; - case QgsComposerItem::ComposerFrame: - sipType = sipType_QgsComposerFrame; - *sipCppRet = static_cast(sipCpp); - break; - default: - sipType = 0; - } + // the conversions have to be static, because they're using multiple inheritance + // (seen in PyQt4 .sip files for some QGraphicsItem classes) + switch ( sipCpp->type() ) + { + case QgsComposerItem::ComposerItem: + sipType = sipType_QgsComposerItem; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerArrow: + sipType = sipType_QgsComposerArrow; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerItemGroup: + sipType = sipType_QgsComposerItemGroup; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerLabel: + sipType = sipType_QgsComposerLabel; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerLegend: + sipType = sipType_QgsComposerLegend; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerMap: + sipType = sipType_QgsComposerMap; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerPaper: + sipType = sipType_QgsPaperItem; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerPicture: + sipType = sipType_QgsComposerPicture; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerScaleBar: + sipType = sipType_QgsComposerScaleBar; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerShape: + sipType = sipType_QgsComposerShape; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerPolygon: + sipType = sipType_QgsComposerPolygon; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerPolyline: + sipType = sipType_QgsComposerPolyline; + *sipCppRet = static_cast( sipCpp ); + break; + case QgsComposerItem::ComposerFrame: + sipType = sipType_QgsComposerFrame; + *sipCppRet = static_cast( sipCpp ); + break; + default: + sipType = 0; + } %End - public: enum ItemType { - // base class for the items + // base ComposerItem, - // derived classes + // derived ComposerArrow, ComposerItemGroup, ComposerLabel, ComposerLegend, ComposerMap, - ComposerPaper, // QgsPaperItem + ComposerPaper, ComposerPicture, ComposerScaleBar, ComposerShape, @@ -107,7 +119,6 @@ class QgsComposerItem : QgsComposerObject, QGraphicsRectItem ComposerFrame }; - /** Describes the action (move or resize in different directon) to be done during mouse move*/ enum MouseMoveAction { MoveItem, @@ -135,522 +146,702 @@ class QgsComposerItem : QgsComposerObject, QGraphicsRectItem LowerRight }; - //note - must sync with QgsMapCanvas::WheelAction. - //TODO - QGIS 3.0 move QgsMapCanvas::WheelAction from GUI->CORE and remove this enum - /** Modes for zooming item content - */ + enum ZoomMode { - Zoom = 0, /*!< Zoom to center of content */ - ZoomRecenter, /*!< Zoom and recenter content to point */ - ZoomToPoint, /*!< Zoom while maintaining relative position of point */ - NoZoom /*!< No zoom */ + Zoom, + ZoomRecenter, + ZoomToPoint, + NoZoom }; - /** Constructor - @param composition parent composition - @param manageZValue true if the z-Value of this object should be managed by mComposition*/ QgsComposerItem( QgsComposition *composition /TransferThis/, bool manageZValue = true ); - /** Constructor with box position and composer object - @param x x coordinate of item - @param y y coordinate of item - @param width width of item - @param height height of item - @param composition parent composition - @param manageZValue true if the z-Value of this object should be managed by mComposition*/ +%Docstring + Constructor +\param composition parent composition +\param manageZValue true if the z-Value of this object should be managed by mComposition* +%End + QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition *composition /TransferThis/, bool manageZValue = true ); +%Docstring + Constructor with box position and composer object +\param x x coordinate of item +\param y y coordinate of item +\param width width of item +\param height height of item +\param composition parent composition +\param manageZValue true if the z-Value of this object should be managed by mComposition* +%End virtual ~QgsComposerItem(); - /** Return correct graphics item type. */ virtual int type() const; +%Docstring +Return correct graphics item type. + :rtype: int +%End - /** Returns whether this item has been removed from the composition. Items removed - * from the composition are not deleted so that they can be restored via an undo - * command. - * @returns true if the item has been removed from the composition - * @note added in QGIS 2.5 - * @see setIsRemoved - */ virtual bool isRemoved() const; +%Docstring + Returns whether this item has been removed from the composition. Items removed + from the composition are not deleted so that they can be restored via an undo + command. + :return: true if the item has been removed from the composition +.. versionadded:: 2.5 +.. seealso:: setIsRemoved + :rtype: bool +%End - /** Sets whether this item has been removed from the composition. Items removed - * from the composition are not deleted so that they can be restored via an undo - * command. - * @param removed set to true if the item has been removed from the composition - * @note added in QGIS 2.5 - * @see isRemoved - */ void setIsRemoved( const bool removed ); +%Docstring + Sets whether this item has been removed from the composition. Items removed + from the composition are not deleted so that they can be restored via an undo + command. + \param removed set to true if the item has been removed from the composition +.. versionadded:: 2.5 +.. seealso:: isRemoved +%End - /** \brief Set selected, selected item should be highlighted */ virtual void setSelected( bool s ); +%Docstring + Set selected, selected item should be highlighted +%End - /** \brief Is selected */ virtual bool selected() const; +%Docstring + Is selected + :rtype: bool +%End - /** Moves item in canvas coordinates*/ void move( double dx, double dy ); +%Docstring +Moves item in canvas coordinates +%End - /** Move Content of item. Does nothing per default (but implemented in composer map) - @param dx move in x-direction (canvas coordinates) - @param dy move in y-direction(canvas coordinates)*/ virtual void moveContent( double dx, double dy ); +%Docstring + Move Content of item. Does nothing per default (but implemented in composer map) +\param dx move in x-direction (canvas coordinates) +\param dy move in y-direction(canvas coordinates)* +%End - /** Zoom content of item. Does nothing per default (but implemented in composer map) - * @param factor zoom factor, where > 1 results in a zoom in and < 1 results in a zoom out - * @param point item point for zoom center - * @param mode zoom mode - * @note added in QGIS 2.5 - */ virtual void zoomContent( const double factor, const QPointF point, const ZoomMode mode = QgsComposerItem::Zoom ); +%Docstring + Zoom content of item. Does nothing per default (but implemented in composer map) + \param factor zoom factor, where > 1 results in a zoom in and < 1 results in a zoom out + \param point item point for zoom center + \param mode zoom mode +.. versionadded:: 2.5 +%End - /** Gets the page the item is currently on. - * @returns page number for item, beginning on page 1 - * @see pagePos - * @see updatePagePos - * @note this method was added in version 2.4 - */ int page() const; +%Docstring + Gets the page the item is currently on. + :return: page number for item, beginning on page 1 +.. seealso:: pagePos +.. seealso:: updatePagePos +.. versionadded:: 2.4 + :rtype: int +%End - /** Returns the item's position relative to its current page. - * @returns position relative to the page's top left corner. - * @see page - * @see updatePagePos - * @note this method was added in version 2.4 - */ QPointF pagePos() const; +%Docstring + Returns the item's position relative to its current page. + :return: position relative to the page's top left corner. +.. seealso:: page +.. seealso:: updatePagePos +.. versionadded:: 2.4 + :rtype: QPointF +%End - /** Moves the item so that it retains its relative position on the page - * when the paper size changes. - * @param newPageWidth new width of the page in mm - * @param newPageHeight new height of the page in mm - * @see page - * @see pagePos - * @note this method was added in version 2.4 - */ void updatePagePos( double newPageWidth, double newPageHeight ); +%Docstring + Moves the item so that it retains its relative position on the page + when the paper size changes. + \param newPageWidth new width of the page in mm + \param newPageHeight new height of the page in mm +.. seealso:: page +.. seealso:: pagePos +.. versionadded:: 2.4 +%End - /** Moves the item to a new position (in canvas coordinates) - @param x item position x (mm) - @param y item position y (mm) - @param itemPoint reference point which coincides with specified position - @param page if page > 0, y is interpreted as relative to the origin of the specified page, if page <= 0, y is in absolute canvas coordinates. - a page number of 1 corresponds to the first page. - */ void setItemPosition( double x, double y, ItemPositionMode itemPoint = UpperLeft, int page = -1 ); +%Docstring + Moves the item to a new position (in canvas coordinates) +\param x item position x (mm) +\param y item position y (mm) +\param itemPoint reference point which coincides with specified position +\param page if page > 0, y is interpreted as relative to the origin of the specified page, if page <= 0, y is in absolute canvas coordinates. +a page number of 1 corresponds to the first page. +%End - /** Sets item position and width / height in one go - @param x item position x (mm) - @param y item position y (mm) - @param width item width (mm) - @param height item height (mm) - @param itemPoint reference point which coincides with specified position - @param posIncludesFrame set to true if the position and size arguments include the item's frame border - @param page if page > 0, y is interpreted as relative to the origin of the specified page, if page <= 0, y is in absolute canvas coordinates. - a page number of 1 corresponds to the first page. - */ void setItemPosition( double x, double y, double width, double height, ItemPositionMode itemPoint = UpperLeft, bool posIncludesFrame = false, int page = -1 ); +%Docstring + Sets item position and width / height in one go +\param x item position x (mm) +\param y item position y (mm) +\param width item width (mm) +\param height item height (mm) +\param itemPoint reference point which coincides with specified position +\param posIncludesFrame set to true if the position and size arguments include the item's frame stroke +\param page if page > 0, y is interpreted as relative to the origin of the specified page, if page <= 0, y is in absolute canvas coordinates. +a page number of 1 corresponds to the first page. +%End - /** Returns item's last used position mode. - @note: This property has no effect on actual's item position, which is always the top-left corner. */ ItemPositionMode lastUsedPositionMode(); +%Docstring + Returns item's last used position mode. +\note: This property has no effect on actual's item position, which is always the top-left corner. * + :rtype: ItemPositionMode +%End - /** Sets this items bound in scene coordinates such that 1 item size units - corresponds to 1 scene size unit*/ virtual void setSceneRect( const QRectF &rectangle ); +%Docstring + Sets this items bound in scene coordinates such that 1 item size units +corresponds to 1 scene size unit* +%End - /** Writes parameter that are not subclass specific in document. Usually called from writeXML methods of subclasses*/ bool _writeXml( QDomElement &itemElem, QDomDocument &doc ) const; +%Docstring +Writes parameter that are not subclass specific in document. Usually called from writeXml methods of subclasses + :rtype: bool +%End - /** Reads parameter that are not subclass specific in document. Usually called from readXML methods of subclasses*/ bool _readXml( const QDomElement &itemElem, const QDomDocument &doc ); +%Docstring +Reads parameter that are not subclass specific in document. Usually called from readXml methods of subclasses + :rtype: bool +%End - /** Whether this item has a frame or not. - * @returns true if there is a frame around this item, otherwise false. - * @see setFrameEnabled - * @see frameStrokeWidth - * @see frameJoinStyle - * @see frameStrokeColor - */ bool hasFrame() const; +%Docstring + Whether this item has a frame or not. + :return: true if there is a frame around this item, otherwise false. +.. seealso:: setFrameEnabled +.. seealso:: frameStrokeWidth +.. seealso:: frameJoinStyle +.. seealso:: frameStrokeColor + :rtype: bool +%End - /** Set whether this item has a frame drawn around it or not. - * @param drawFrame draw frame - * @see hasFrame - * @see setFrameStrokeWidth - * @see setFrameJoinStyle - * @see setFrameStrokeColor - */ virtual void setFrameEnabled( const bool drawFrame ); +%Docstring + Set whether this item has a frame drawn around it or not. + \param drawFrame draw frame +.. seealso:: hasFrame +.. seealso:: setFrameStrokeWidth +.. seealso:: setFrameJoinStyle +.. seealso:: setFrameStrokeColor +%End - /** Sets frame stroke color - * @param color new color for stroke frame - * @note introduced in 2.6 - * @see frameStrokeColor - * @see setFrameEnabled - * @see setFrameJoinStyle - * @see setFrameStrokeWidth - */ virtual void setFrameStrokeColor( const QColor &color ); +%Docstring + Sets frame stroke color + \param color new color for stroke frame +.. versionadded:: 2.6 +.. seealso:: frameStrokeColor +.. seealso:: setFrameEnabled +.. seealso:: setFrameJoinStyle +.. seealso:: setFrameStrokeWidth +%End - /** Returns the frame's stroke color. Only used if hasFrame is true. - * @returns frame stroke color - * @note introduced in 2.6 - * @see hasFrame - * @see setFrameStrokeColor - * @see frameJoinStyle - * @see setFrameStrokeColor - */ QColor frameStrokeColor() const; +%Docstring + Returns the frame's stroke color. Only used if hasFrame is true. + :return: frame stroke color +.. versionadded:: 2.6 +.. seealso:: hasFrame +.. seealso:: setFrameStrokeColor +.. seealso:: frameJoinStyle +.. seealso:: setFrameStrokeColor + :rtype: QColor +%End - /** Sets frame stroke width - * @param strokeWidth new width for stroke frame - * @note introduced in 2.2 - * @see frameStrokeWidth - * @see setFrameEnabled - * @see setFrameJoinStyle - * @see setFrameStrokeColor - */ virtual void setFrameStrokeWidth( const double strokeWidth ); +%Docstring + Sets frame stroke width + \param strokeWidth new width for stroke frame +.. versionadded:: 2.2 +.. seealso:: frameStrokeWidth +.. seealso:: setFrameEnabled +.. seealso:: setFrameJoinStyle +.. seealso:: setFrameStrokeColor +%End - /** Returns the frame's stroke width. Only used if hasFrame is true. - * @returns Frame stroke width - * @note introduced in 2.3 - * @see hasFrame - * @see setFrameStrokeWidth - * @see frameJoinStyle - * @see frameStrokeColor - */ double frameStrokeWidth() const; +%Docstring + Returns the frame's stroke width. Only used if hasFrame is true. + :return: Frame stroke width +.. versionadded:: 2.3 +.. seealso:: hasFrame +.. seealso:: setFrameStrokeWidth +.. seealso:: frameJoinStyle +.. seealso:: frameStrokeColor + :rtype: float +%End - /** Returns the join style used for drawing the item's frame - * @returns Join style for outline frame - * @note introduced in 2.3 - * @see hasFrame - * @see setFrameJoinStyle - * @see frameStrokeWidth - * @see frameStrokeColor - */ Qt::PenJoinStyle frameJoinStyle() const; +%Docstring + Returns the join style used for drawing the item's frame + :return: Join style for stroke frame +.. versionadded:: 2.3 +.. seealso:: hasFrame +.. seealso:: setFrameJoinStyle +.. seealso:: frameStrokeWidth +.. seealso:: frameStrokeColor + :rtype: Qt.PenJoinStyle +%End - /** Sets join style used when drawing the item's frame - * @param style Join style for outline frame - * @note introduced in 2.3 - * @see setFrameEnabled - * @see frameJoinStyle - * @see setFrameStrokeWidth - * @see setFrameStrokeColor - */ void setFrameJoinStyle( const Qt::PenJoinStyle style ); +%Docstring + Sets join style used when drawing the item's frame + \param style Join style for stroke frame +.. versionadded:: 2.3 +.. seealso:: setFrameEnabled +.. seealso:: frameJoinStyle +.. seealso:: setFrameStrokeWidth +.. seealso:: setFrameStrokeColor +%End - /** Returns the estimated amount the item's frame bleeds outside the item's - * actual rectangle. For instance, if the item has a 2mm frame stroke, then - * 1mm of this frame is drawn outside the item's rect. In this case the - * return value will be 1.0 - * @note introduced in 2.2 - * @see rectWithFrame - */ virtual double estimatedFrameBleed() const; +%Docstring + Returns the estimated amount the item's frame bleeds outside the item's + actual rectangle. For instance, if the item has a 2mm frame stroke, then + 1mm of this frame is drawn outside the item's rect. In this case the + return value will be 1.0 +.. versionadded:: 2.2 +.. seealso:: rectWithFrame + :rtype: float +%End - /** Returns the item's rectangular bounds, including any bleed caused by the item's frame. - * The bounds are returned in the item's coordinate system (see Qt's QGraphicsItem docs for - * more details about QGraphicsItem coordinate systems). The results differ from Qt's rect() - * function, as rect() makes no allowances for the portion of outlines which are drawn - * outside of the item. - * @note introduced in 2.2 - * @see estimatedFrameBleed - */ virtual QRectF rectWithFrame() const; +%Docstring + Returns the item's rectangular bounds, including any bleed caused by the item's frame. + The bounds are returned in the item's coordinate system (see Qt's QGraphicsItem docs for + more details about QGraphicsItem coordinate systems). The results differ from Qt's rect() + function, as rect() makes no allowances for the portion of outlines which are drawn + outside of the item. +.. versionadded:: 2.2 +.. seealso:: estimatedFrameBleed + :rtype: QRectF +%End - /** Whether this item has a Background or not. - * @returns true if there is a Background around this item, otherwise false. - * @see setBackgroundEnabled - * @see backgroundColor - */ bool hasBackground() const; +%Docstring + Whether this item has a Background or not. + :return: true if there is a Background around this item, otherwise false. +.. seealso:: setBackgroundEnabled +.. seealso:: backgroundColor + :rtype: bool +%End - /** Set whether this item has a Background drawn around it or not. - * @param drawBackground draw Background - * @returns nothing - * @see hasBackground - * @see setBackgroundColor - */ void setBackgroundEnabled( const bool drawBackground ); +%Docstring + Set whether this item has a Background drawn around it or not. + \param drawBackground draw Background + :return: nothing +.. seealso:: hasBackground +.. seealso:: setBackgroundColor +%End - /** Gets the background color for this item - * @returns background color - * @see setBackgroundColor - * @see hasBackground - */ QColor backgroundColor() const; +%Docstring + Gets the background color for this item + :return: background color +.. seealso:: setBackgroundColor +.. seealso:: hasBackground + :rtype: QColor +%End - /** Sets the background color for this item - * @param backgroundColor new background color - * @returns nothing - * @see backgroundColor - * @see setBackgroundEnabled - */ void setBackgroundColor( const QColor &backgroundColor ); +%Docstring + Sets the background color for this item + \param backgroundColor new background color + :return: nothing +.. seealso:: backgroundColor +.. seealso:: setBackgroundEnabled +%End - /** Returns the item's composition blending mode. - * @returns item blending mode - * @see setBlendMode - */ QPainter::CompositionMode blendMode() const; +%Docstring + Returns the item's composition blending mode. + :return: item blending mode +.. seealso:: setBlendMode + :rtype: QPainter.CompositionMode +%End - /** Sets the item's composition blending mode - * @param blendMode blending mode for item - * @see blendMode - */ void setBlendMode( const QPainter::CompositionMode blendMode ); +%Docstring + Sets the item's composition blending mode + \param blendMode blending mode for item +.. seealso:: blendMode +%End double itemOpacity() const; +%Docstring + Returns the item's opacity. This method should be used instead of + QGraphicsItem.opacity() as any data defined overrides will be + respected. + :return: opacity as double between 1.0 (opaque) and 0 (transparent). +.. seealso:: setItemOpacity() + :rtype: float +%End + void setItemOpacity( const double opacity ); +%Docstring + Sets the item's ``opacity``. This method should be used instead of + QGraphicsItem.setOpacity() as any data defined overrides will be + respected. + \param opacity double between 1.0 (opaque) and 0 (transparent). +.. seealso:: itemOpacity() +%End - /** Returns whether effects (e.g., blend modes) are enabled for the item - * @returns true if effects are enabled - * @see setEffectsEnabled - * @see transparency - * @see blendMode - */ bool effectsEnabled() const; +%Docstring + Returns whether effects (e.g., blend modes) are enabled for the item + :return: true if effects are enabled +.. seealso:: setEffectsEnabled +.. seealso:: itemOpacity() +.. seealso:: blendMode + :rtype: bool +%End - /** Sets whether effects (e.g., blend modes) are enabled for the item - * @param effectsEnabled set to true to enable effects - * @see effectsEnabled - * @see setTransparency - * @see setBlendMode - */ void setEffectsEnabled( const bool effectsEnabled ); +%Docstring + Sets whether effects (e.g., blend modes) are enabled for the item + \param effectsEnabled set to true to enable effects +.. seealso:: effectsEnabled +.. seealso:: setItemOpacity() +.. seealso:: setBlendMode +%End - /** Composite operations for item groups do nothing per default*/ virtual void addItem( QgsComposerItem *item ); +%Docstring +Composite operations for item groups do nothing per default +%End virtual void removeItems(); virtual void beginItemCommand( const QString &text ); - /** Starts new composer undo command - @param commandText command title - @param c context for mergeable commands (unknown for non-mergeable commands*/ void beginCommand( const QString &commandText, QgsComposerMergeCommand::Context c = QgsComposerMergeCommand::Unknown ); +%Docstring + Starts new composer undo command +\param commandText command title +\param c context for mergeable commands (unknown for non-mergeable commands* +%End virtual void endItemCommand(); - /** Finish current command and push it onto the undo stack */ void endCommand(); +%Docstring +Finish current command and push it onto the undo stack +%End void cancelCommand(); - //functions that encapsulate the workaround for the Qt font bug (that is to scale the font size up and then scale the - //painter down by the same factor for drawing - /** Locks / unlocks the item position for mouse drags - * @param lock set to true to prevent item movement and resizing via the mouse - * @see positionLock - */ void setPositionLock( const bool lock ); +%Docstring + Locks / unlocks the item position for mouse drags + \param lock set to true to prevent item movement and resizing via the mouse +.. seealso:: positionLock +%End - /** Returns whether position lock for mouse drags is enabled - * returns true if item is locked for mouse movement and resizing - * @see setPositionLock - */ bool positionLock() const; +%Docstring + Returns whether position lock for mouse drags is enabled + returns true if item is locked for mouse movement and resizing +.. seealso:: setPositionLock + :rtype: bool +%End - /** Returns the current rotation for the composer item. - * @returns rotation for composer item - * @param valueType controls whether the returned value is the user specified rotation, - * or the current evaluated rotation (which may be affected by data driven rotation - * settings). - * @note this method was added in version 2.1 - * @see setItemRotation - */ double itemRotation( const QgsComposerObject::PropertyValueType valueType = QgsComposerObject::EvaluatedValue ) const; +%Docstring + Returns the current rotation for the composer item, in degrees clockwise. + \param valueType controls whether the returned value is the user specified rotation, + or the current evaluated rotation (which may be affected by data driven rotation + settings). +.. versionadded:: 2.1 +.. seealso:: setItemRotation() + :rtype: float +%End - /** Updates item, with the possibility to do custom update for subclasses*/ virtual void updateItem(); +%Docstring + Updates (redraws) the item, with the possibility to do custom update for subclasses. + Subclasses should check updatesEnabled() to determine whether updates are + currently permitted for the item. +%End - /** Get item's id (which is not necessarly unique) - * @returns item id - * @see setId - */ QString id() const; +%Docstring + Get item's id (which is not necessarly unique) + :return: item id +.. seealso:: setId + :rtype: str +%End - /** Set item's id (which is not necessarly unique) - * @param id new id for item - * @see id - */ - void setId( const QString &id ); + virtual void setId( const QString &id ); +%Docstring + Set item's id (which is not necessarly unique) + \param id new id for item +.. seealso:: id +%End - /** Get item identification name - * @returns unique item identification string - * @note there is not setter since one can't manually set the id - * @see id - * @see setId - */ QString uuid() const; +%Docstring + Get item identification name + :return: unique item identification string +.. note:: + + there is not setter since one can't manually set the id +.. seealso:: id +.. seealso:: setId + :rtype: str +%End - /** Get item display name. This is the item's id if set, and if - * not, a user-friendly string identifying item type. - * @returns display name for item - * @see id - * @see setId - * @note added in version 2.5 - */ virtual QString displayName() const; +%Docstring + Get item display name. This is the item's id if set, and if + not, a user-friendly string identifying item type. + :return: display name for item +.. seealso:: id +.. seealso:: setId +.. versionadded:: 2.5 + :rtype: str +%End - /** Sets visibility for item. - * @param visible set to true to show item, false to hide item - * @note QGraphicsItem::setVisible should not be called directly - * on a QgsComposerItem, as some item types (e.g., groups) need to override - * the visibility toggle. - * @note added in version 2.5 - */ virtual void setVisibility( const bool visible ); +%Docstring + Sets visibility for item. + \param visible set to true to show item, false to hide item +.. note:: + + QGraphicsItem.setVisible should not be called directly + on a QgsComposerItem, as some item types (e.g., groups) need to override + the visibility toggle. +.. versionadded:: 2.5 +%End - /** Returns whether the item should be excluded from composer exports and prints - * @param valueType controls whether the returned value is the user specified value, - * or the current evaluated value (which may be affected by data driven settings). - * @returns true if item should be excluded - * @note added in version 2.5 - * @see setExcludeFromExports - */ bool excludeFromExports( const QgsComposerObject::PropertyValueType valueType = QgsComposerObject::EvaluatedValue ); +%Docstring + Returns whether the item should be excluded from composer exports and prints + \param valueType controls whether the returned value is the user specified value, + or the current evaluated value (which may be affected by data driven settings). + :return: true if item should be excluded +.. versionadded:: 2.5 +.. seealso:: setExcludeFromExports + :rtype: bool +%End - /** Sets whether the item should be excluded from composer exports and prints - * @param exclude set to true to exclude the item from exports - * @note added in version 2.5 - * @see excludeFromExports - */ virtual void setExcludeFromExports( const bool exclude ); +%Docstring + Sets whether the item should be excluded from composer exports and prints + \param exclude set to true to exclude the item from exports +.. versionadded:: 2.5 +.. seealso:: excludeFromExports +%End - /** Returns whether this item is part of a group - * @returns true if item is in a group - * @note added in version 2.5 - * @see setIsGroupMember - */ bool isGroupMember() const; +%Docstring + Returns whether this item is part of a group + :return: true if item is in a group +.. versionadded:: 2.5 +.. seealso:: setIsGroupMember + :rtype: bool +%End - /** Sets whether this item is part of a group - * @param isGroupMember set to true if item is in a group - * @note added in version 2.5 - * @see isGroupMember - */ void setIsGroupMember( const bool isGroupMember ); - - - - - - +%Docstring + Sets whether this item is part of a group + \param isGroupMember set to true if item is in a group +.. versionadded:: 2.5 +.. seealso:: isGroupMember +%End virtual int numberExportLayers() const; - - - - - +%Docstring + Get the number of layers that this item requires for exporting as layers + :return: 0 if this item is to be placed on the same layer as the previous item, + 1 if it should be placed on its own layer, and >1 if it requires multiple export layers +.. versionadded:: 2.4 +.. seealso:: setCurrentExportLayer + :rtype: int +%End virtual void setCurrentExportLayer( const int layerIdx = -1 ); - - - - +%Docstring + Sets the current layer to draw for exporting + \param layerIdx can be set to -1 to draw all item layers, and must be less than numberExportLayers() +.. versionadded:: 2.4 +.. seealso:: numberExportLayers +%End virtual QgsExpressionContext createExpressionContext() const; +%Docstring + Creates an expression context relating to the item's current state. The context includes + scopes for global, project, composition, atlas and item properties. +.. versionadded:: 2.12 + :rtype: QgsExpressionContext +%End + void setUpdatesEnabled( bool enabled ); +%Docstring + Sets whether updates to the item are enabled. If false, + the item will not be redrawn. This can be used to prevent + multiple item updates when many settings for an item are + changed sequentially. +.. versionadded:: 3.0 +.. seealso:: updatesEnabled() +%End + bool updatesEnabled() const; +%Docstring + Returns whether updates to the item are enabled. If false, + the item will not be redrawn. This can be used to prevent + multiple item updates when many settings for an item are + changed sequentially. +.. versionadded:: 3.0 +.. seealso:: setUpdatesEnabled() + :rtype: bool +%End public slots: - /** Sets the item rotation - * @param r item rotation in degrees - * @param adjustPosition set to true if item should be shifted so that rotation occurs - * around item center. If false, rotation occurs around item origin - * @note this method was added in version 2.1 - * @see itemRotation - */ - virtual void setItemRotation( const double r, const bool adjustPosition = false ); + virtual void setItemRotation( const double rotation, const bool adjustPosition = false ); +%Docstring + Sets the item ``rotation``, in degrees clockwise. + \param rotation item rotation in degrees + \param adjustPosition set to true if item should be shifted so that rotation occurs + around item center. If false, rotation occurs around item origin +.. versionadded:: 2.1 +.. seealso:: itemRotation +%End + + virtual void repaint(); - void repaint(); - /** Refreshes a data defined property for the item by reevaluating the property's value - * and redrawing the item with this new value. - * @param property data defined property to refresh. If property is set to - * QgsComposerItem::AllProperties then all data defined properties for the item will be - * refreshed. - * @param context expression context for evaluating data defined expressions - * @note this method was added in version 2.5 - */ virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = 0 ); +%Docstring + Refreshes a data defined property for the item by reevaluating the property's value + and redrawing the item with this new value. + \param property data defined property to refresh. If property is set to + QgsComposerItem.AllProperties then all data defined properties for the item will be + refreshed. + \param context expression context for evaluating data defined expressions +.. versionadded:: 2.5 +%End protected: - //event handlers - virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *event ); - virtual void mousePressEvent( QGraphicsSceneMouseEvent *event ); - virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent *event ); - virtual void hoverMoveEvent( QGraphicsSceneHoverEvent *event ); - /** Draws additional graphics on selected items. The base implementation has - * no effect. - */ + + + + + + + + + + + + + virtual void drawSelectionBoxes( QPainter *p ); +%Docstring + Draws additional graphics on selected items. The base implementation has + no effect. +%End - /** Draw black frame around item*/ virtual void drawFrame( QPainter *p ); +%Docstring +Draw black frame around item +%End - /** Draw background*/ virtual void drawBackground( QPainter *p ); +%Docstring +Draw background +%End - /** Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the - item border for resizing*/ double rectHandlerBorderTolerance() const; +%Docstring + Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the +item border for resizing* + :rtype: float +%End - /** Returns the zoom factor of the graphics view. - * @return the factor or -1 in case of error (e.g. graphic view does not exist) - */ double horizontalViewScaleFactor() const; +%Docstring + Returns the zoom factor of the graphics view. + :return: the factor or -1 in case of error (e.g. graphic view does not exist) + :rtype: float +%End - //some utility functions - /** Return horizontal align snap item. Creates a new graphics line if 0*/ QGraphicsLineItem *hAlignSnapItem(); +%Docstring +Return horizontal align snap item. Creates a new graphics line if 0 + :rtype: QGraphicsLineItem +%End void deleteHAlignSnapItem(); - /** Return vertical align snap item. Creates a new graphics line if 0*/ QGraphicsLineItem *vAlignSnapItem(); +%Docstring +Return vertical align snap item. Creates a new graphics line if 0 + :rtype: QGraphicsLineItem +%End void deleteVAlignSnapItem(); void deleteAlignItems(); - /** Evaluates an item's bounding rect to consider data defined position and size of item - * and reference point - * @param newRect target bounding rect for item - * @param resizeOnly set to true if the item is only being resized. If true then - * the position of the returned rect will be adjusted to account for the item's - * position mode - * @param context expression context for evaluating data defined expressions - * @returns bounding box rectangle for item after data defined size and position have been - * set and position mode has been accounted for - * @note added in QGIS 2.5 - */ QRectF evalItemRect( const QRectF &newRect, const bool resizeOnly = false, const QgsExpressionContext *context = 0 ); +%Docstring + Evaluates an item's bounding rect to consider data defined position and size of item + and reference point + \param newRect target bounding rect for item + \param resizeOnly set to true if the item is only being resized. If true then + the position of the returned rect will be adjusted to account for the item's + position mode + \param context expression context for evaluating data defined expressions + :return: bounding box rectangle for item after data defined size and position have been + set and position mode has been accounted for +.. versionadded:: 2.5 + :rtype: QRectF +%End - /** Returns whether the item should be drawn in the current context - * @returns true if item should be drawn - * @note added in QGIS 2.5 - */ bool shouldDrawItem() const; +%Docstring + Returns whether the item should be drawn in the current context + :return: true if item should be drawn +.. versionadded:: 2.5 + :rtype: bool +%End signals: - /** Is emitted on item rotation change*/ void itemRotationChanged( double newRotation ); - /** Emitted if the rectangle changes*/ +%Docstring +Is emitted on item rotation change +%End void sizeChanged(); - /** Emitted if the item's frame style changes - * @note: this function was introduced in version 2.2 - */ +%Docstring +Emitted if the rectangle changes +%End + void frameChanged(); - /** Emitted if the item's lock status changes - * @note: this function was introduced in version 2.5 - */ +%Docstring + Emitted if the item's frame style changes +.. versionadded:: 2.2 +%End + void lockChanged(); +%Docstring + Emitted if the item's lock status changes +.. versionadded:: 2.5 +%End }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritem.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposeritemcommand.sip b/python/core/composer/qgscomposeritemcommand.sip index 8c5bb5195c1..15b6618f415 100644 --- a/python/core/composer/qgscomposeritemcommand.sip +++ b/python/core/composer/qgscomposeritemcommand.sip @@ -1,63 +1,107 @@ -/** \ingroup core -Undo command to undo/redo all composer item related changes*/ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritemcommand.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + + class QgsComposerItemCommand: QUndoCommand { +%Docstring + Undo command to undo/redo all composer item related changes +%End + %TypeHeaderCode - #include "qgscomposeritemcommand.h" +#include "qgscomposeritemcommand.h" %End public: QgsComposerItemCommand( QgsComposerItem *item, const QString &text, QUndoCommand *parent /TransferThis/ = 0 ); - virtual ~QgsComposerItemCommand(); - /** Reverses the command*/ - void undo(); - /** Replays the command*/ - void redo(); + virtual void undo(); + +%Docstring +Reverses the command +%End + virtual void redo(); + +%Docstring +Replays the command +%End - /** Saves current item state as previous state*/ void savePreviousState(); - /** Saves current item state as after state*/ +%Docstring +Saves current item state as previous state +%End void saveAfterState(); +%Docstring +Saves current item state as after state +%End QDomDocument previousState() const; +%Docstring + :rtype: QDomDocument +%End QDomDocument afterState() const; +%Docstring + :rtype: QDomDocument +%End - /** Returns true if previous state and after state are valid and different*/ bool containsChange() const; +%Docstring +Returns true if previous state and after state are valid and different + :rtype: bool +%End - /** Returns the target item the command applies to. - * @returns target composer item - */ QgsComposerItem *item() const; +%Docstring + Returns the target item the command applies to. + :return: target composer item + :rtype: QgsComposerItem +%End protected: + + + void saveState( QDomDocument &stateDoc ) const; +%Docstring +Flag to prevent the first redo() if the command is pushed to the undo stack +%End void restoreState( QDomDocument &stateDoc ) const; }; -/** A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the - newest after state. The purpose is to avoid too many micro changes in the history*/ -class QgsComposerMergeCommand : QgsComposerItemCommand +class QgsComposerMergeCommand: QgsComposerItemCommand { +%Docstring + A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the +newest after state. The purpose is to avoid too many micro changes in the history +%End + %TypeHeaderCode - #include "qgscomposeritemcommand.h" +#include "qgscomposeritemcommand.h" %End public: enum Context { Unknown, - //composer label + //composer ComposerLabelSetText, ComposerLabelSetId, ComposerLabelFontColor, - //composer map + //composer ComposerMapRotation, ComposerMapAnnotationDistance, ComposerMapGridFramePenColor, ComposerMapGridFrameFill1Color, ComposerMapGridFrameFill2Color, ComposerMapGridAnnotationFontColor, - //composer legend + //composer ComposerLegendText, LegendColumnCount, LegendSplitLayer, @@ -73,14 +117,16 @@ class QgsComposerMergeCommand : QgsComposerItemCommand LegendIconSymbolSpace, LegendBoxSpace, LegendColumnSpace, + LegendLineSpacing, LegendRasterStrokeWidth, LegendFontColor, LegendRasterStrokeColor, - //composer picture + //composer ComposerPictureRotation, ComposerPictureFillColor, ComposerPictureStrokeColor, - // composer scalebar + ComposerPictureNorthOffset, + // composer ScaleBarLineWidth, ScaleBarHeight, ScaleBarSegmentSize, @@ -94,14 +140,14 @@ class QgsComposerMergeCommand : QgsComposerItemCommand ScaleBarFillColor, ScaleBarFill2Color, ScaleBarStrokeColor, - // composer table + // composer TableMaximumFeatures, TableMargin, TableGridStrokeWidth, - //composer shape + //composer ShapeCornerRadius, ShapeStrokeWidth, - //composer arrow + //composer ArrowStrokeWidth, ArrowHeadFillColor, ArrowHeadStrokeColor, @@ -117,8 +163,17 @@ class QgsComposerMergeCommand : QgsComposerItemCommand }; QgsComposerMergeCommand( Context c, QgsComposerItem *item, const QString &text ); - ~QgsComposerMergeCommand(); - bool mergeWith( const QUndoCommand *command ); - int id() const; + virtual bool mergeWith( const QUndoCommand *command ); + + virtual int id() const; + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritemcommand.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposeritemgroup.sip b/python/core/composer/qgscomposeritemgroup.sip index f32872ae3c6..f3d379c6cc1 100644 --- a/python/core/composer/qgscomposeritemgroup.sip +++ b/python/core/composer/qgscomposeritemgroup.sip @@ -1,42 +1,80 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritemgroup.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + class QgsComposerItemGroup: QgsComposerItem { +%Docstring + A container for grouping several QgsComposerItems +%End + %TypeHeaderCode -#include +#include "qgscomposeritemgroup.h" %End public: QgsComposerItemGroup( QgsComposition *c /TransferThis/ ); ~QgsComposerItemGroup(); - /** Return correct graphics item type. */ virtual int type() const; +%Docstring +Return correct graphics item type. + :rtype: int +%End - /** Adds an item to the group. All the group members are deleted - if the group is deleted*/ - void addItem( QgsComposerItem *item ); - /** Removes the items but does not delete them*/ - void removeItems(); - /** Draw outline and ev. selection handles*/ - void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 ); - /** Sets this items bound in scene coordinates such that 1 item size units - corresponds to 1 scene size unit*/ - void setSceneRect( const QRectF &rectangle ); + virtual void addItem( QgsComposerItem *item ); + +%Docstring + Adds an item to the group. All the group members are deleted +if the group is deleted* +%End + virtual void removeItems(); + +%Docstring +Removes the items but does not delete them +%End + virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 ); + +%Docstring +Draw stroke and ev. selection handles +%End + + virtual void setSceneRect( const QRectF &rectangle ); + +%Docstring + Sets this items bound in scene coordinates such that 1 item size units +corresponds to 1 scene size unit* +%End - //overridden to also hide grouped items virtual void setVisibility( const bool visible ); - /** Stores state in Dom node - * @param elem is Dom element corresponding to 'Composer' tag - * @param doc is the Dom document - */ - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; - /** Sets state from Dom document - * @param itemElem is Dom node corresponding to item tag - * @param doc is the Dom document - */ - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); +%Docstring + Stores state in Dom node + \param elem is Dom element corresponding to 'Composer' tag + \param doc is the Dom document + :rtype: bool +%End - QSet items(); + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + +%Docstring + Sets state from Dom document + \param itemElem is Dom node corresponding to item tag + \param doc is the Dom document + :rtype: bool +%End + + QSet items(); +%Docstring + :rtype: set of QgsComposerItem +%End signals: void childItemDeleted( QgsComposerItem *item ); @@ -45,5 +83,15 @@ class QgsComposerItemGroup: QgsComposerItem void itemDestroyed(); protected: - void drawFrame( QPainter *p ); + virtual void drawFrame( QPainter *p ); + + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposeritemgroup.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposerlabel.sip b/python/core/composer/qgscomposerlabel.sip index 8258180117e..c2fdaa5b782 100644 --- a/python/core/composer/qgscomposerlabel.sip +++ b/python/core/composer/qgscomposerlabel.sip @@ -1,129 +1,203 @@ -/** \ingroup core - * A label that can be placed onto a map composition. - */ -class QgsComposerLabel : QgsComposerItem +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerlabel.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + +class QgsComposerLabel: QgsComposerItem { +%Docstring + A label that can be placed onto a map composition. +%End + %TypeHeaderCode #include "qgscomposerlabel.h" %End public: - QgsComposerLabel( QgsComposition *composition /TransferThis/); + QgsComposerLabel( QgsComposition *composition ); ~QgsComposerLabel(); - /** Return correct graphics item type. */ virtual int type() const; +%Docstring +Return correct graphics item type. + :rtype: int +%End - /** \brief Reimplementation of QCanvasItem::paint*/ - void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); + virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); + +%Docstring + Reimplementation of QCanvasItem.paint +%End - /** Resizes the widget such that the text fits to the item. Keeps top left point*/ void adjustSizeToText(); +%Docstring +Resizes the widget such that the text fits to the item. Keeps top left point +%End QString text(); +%Docstring + :rtype: str +%End void setText( const QString &text ); int htmlState(); +%Docstring + :rtype: int +%End void setHtmlState( int state ); - /** Returns the text as it appears on screen (with replaced data field) */ QString displayText() const; +%Docstring +Returns the text as it appears on screen (with replaced data field) + :rtype: str +%End QFont font() const; +%Docstring + :rtype: QFont +%End void setFont( const QFont &f ); - /** Accessor for the vertical alignment of the label - * @returns Qt::AlignmentFlag - */ + Qt::AlignmentFlag vAlign() const; - /** Accessor for the horizontal alignment of the label - * @returns Qt::AlignmentFlag - */ +%Docstring + Accessor for the vertical alignment of the label + :return: Qt.AlignmentFlag + :rtype: Qt.AlignmentFlag +%End + Qt::AlignmentFlag hAlign() const; - /** Mutator for the horizontal alignment of the label - * @param a alignment - * @returns void - */ +%Docstring + Accessor for the horizontal alignment of the label + :return: Qt.AlignmentFlag + :rtype: Qt.AlignmentFlag +%End + void setHAlign( Qt::AlignmentFlag a ); - /** Mutator for the vertical alignment of the label - * @param a alignment - * @returns void - */ +%Docstring + Mutator for the horizontal alignment of the label + \param a alignment + :return: void +%End + void setVAlign( Qt::AlignmentFlag a ); +%Docstring + Mutator for the vertical alignment of the label + \param a alignment + :return: void +%End - /** Returns the horizontal margin between the edge of the frame and the label - * contents. - * @returns horizontal margin in mm - * @note added in QGIS 2.7 - */ double marginX() const; +%Docstring + Returns the horizontal margin between the edge of the frame and the label + contents. + :return: horizontal margin in mm +.. versionadded:: 2.7 + :rtype: float +%End - /** Returns the vertical margin between the edge of the frame and the label - * contents. - * @returns vertical margin in mm - * @note added in QGIS 2.7 - */ double marginY() const; +%Docstring + Returns the vertical margin between the edge of the frame and the label + contents. + :return: vertical margin in mm +.. versionadded:: 2.7 + :rtype: float +%End - /** Sets the margin between the edge of the frame and the label contents. - * This method sets both the horizontal and vertical margins to the same - * value. The margins can be individually controlled using the setMarginX - * and setMarginY methods. - * @param m margin in mm - * @see setMarginX - * @see setMarginY - */ void setMargin( const double m ); +%Docstring + Sets the margin between the edge of the frame and the label contents. + This method sets both the horizontal and vertical margins to the same + value. The margins can be individually controlled using the setMarginX + and setMarginY methods. + \param m margin in mm +.. seealso:: setMarginX +.. seealso:: setMarginY +%End - /** Sets the horizontal margin between the edge of the frame and the label - * contents. - * @param margin horizontal margin in mm - * @see setMargin - * @see setMarginY - * @note added in QGIS 2.7 - */ void setMarginX( const double margin ); +%Docstring + Sets the horizontal margin between the edge of the frame and the label + contents. + \param margin horizontal margin in mm +.. seealso:: setMargin +.. seealso:: setMarginY +.. versionadded:: 2.7 +%End - /** Sets the vertical margin between the edge of the frame and the label - * contents. - * @param margin vertical margin in mm - * @see setMargin - * @see setMarginX - * @note added in QGIS 2.7 - */ void setMarginY( const double margin ); +%Docstring + Sets the vertical margin between the edge of the frame and the label + contents. + \param margin vertical margin in mm +.. seealso:: setMargin +.. seealso:: setMarginX +.. versionadded:: 2.7 +%End - /** Sets text color */ void setFontColor( const QColor &c ); - /** Get font color */ +%Docstring +Sets text color +%End QColor fontColor() const; +%Docstring +Get font color + :rtype: QColor +%End - /** Stores state in Dom element - * @param elem is Dom element corresponding to 'Composer' tag - * @param doc document - */ - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; - /** Sets state from Dom document - * @param itemElem is Dom element corresponding to 'ComposerLabel' tag - * @param doc document - */ - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); +%Docstring + Stores state in Dom element + \param elem is Dom element corresponding to 'Composer' tag + \param doc document + :rtype: bool +%End + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + +%Docstring + Sets state from Dom document + \param itemElem is Dom element corresponding to 'ComposerLabel' tag + \param doc document + :rtype: bool +%End - //Overridden to contain part of label's text virtual QString displayName() const; - /** In case of negative margins, the bounding rect may be larger than the - * label's frame - */ - QRectF boundingRect() const; + virtual QRectF boundingRect() const; + +%Docstring + In case of negative margins, the bounding rect may be larger than the + label's frame + :rtype: QRectF +%End - /** Reimplemented to call prepareGeometryChange after toggling frame - */ virtual void setFrameEnabled( const bool drawFrame ); +%Docstring + Reimplemented to call prepareGeometryChange after toggling frame +%End - /** Reimplemented to call prepareGeometryChange after changing stroke width - */ virtual void setFrameStrokeWidth( const double strokeWidth ); +%Docstring + Reimplemented to call prepareGeometryChange after changing stroke width +%End public slots: void refreshExpressionContext(); + + }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerlabel.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposerlegend.sip b/python/core/composer/qgscomposerlegend.sip index b96fa58277c..df0817f3bb2 100644 --- a/python/core/composer/qgscomposerlegend.sip +++ b/python/core/composer/qgscomposerlegend.sip @@ -1,254 +1,391 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerlegend.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + -/** \ingroup core - * Item model implementation based on layer tree model for composer legend. - * Overrides some functionality of QgsLayerTreeModel to better fit the needs of composer legend. - * - * @note added in 2.6 - */ class QgsLegendModel : QgsLayerTreeModel { -%TypeHeaderCode -#include +%Docstring + Item model implementation based on layer tree model for composer legend. + Overrides some functionality of QgsLayerTreeModel to better fit the needs of composer legend. + +.. versionadded:: 2.6 %End +%TypeHeaderCode +#include "qgscomposerlegend.h" +%End public: - //! Construct the model based on the given layer tree QgsLegendModel( QgsLayerTree *rootNode, QObject *parent /TransferThis/ = 0 ); +%Docstring +Construct the model based on the given layer tree +%End - QVariant data( const QModelIndex &index, int role ) const; + virtual QVariant data( const QModelIndex &index, int role ) const; + + + virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - Qt::ItemFlags flags( const QModelIndex &index ) const; }; -/** \ingroup core - * A legend that can be placed onto a map composition - */ class QgsComposerLegend : QgsComposerItem { -%TypeHeaderCode -#include -#include +%Docstring + A legend that can be placed onto a map composition %End +%TypeHeaderCode +#include "qgscomposerlegend.h" +%End public: - QgsComposerLegend( QgsComposition *composition /TransferThis/); - ~QgsComposerLegend(); + QgsComposerLegend( QgsComposition *composition ); - /** Return correct graphics item type. */ virtual int type() const; +%Docstring +Return correct graphics item type. + :rtype: int +%End - /** \brief Reimplementation of QCanvasItem::paint*/ - void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); + virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ); + +%Docstring + Reimplementation of QCanvasItem.paint +%End - /** Paints the legend and calculates its size. If painter is 0, only size is calculated*/ QSizeF paintAndDetermineSize( QPainter *painter ); +%Docstring +Paints the legend and calculates its size. If painter is 0, only size is calculated + :rtype: QSizeF +%End - /** Sets item box to the whole content*/ void adjustBoxSize(); +%Docstring +Sets item box to the whole content +%End - /** Sets whether the legend should automatically resize to fit its contents. - * @param enabled set to false to disable automatic resizing. The legend frame will not - * be expanded to fit legend items, and items may be cropped from display. - * @see resizeToContents() - * @note added in QGIS 3.0 - */ void setResizeToContents( bool enabled ); +%Docstring + Sets whether the legend should automatically resize to fit its contents. + \param enabled set to false to disable automatic resizing. The legend frame will not + be expanded to fit legend items, and items may be cropped from display. +.. seealso:: resizeToContents() +.. versionadded:: 3.0 +%End - /** Returns whether the legend should automatically resize to fit its contents. - * @see setResizeToContents() - * @note added in QGIS 3.0 - */ bool resizeToContents() const; +%Docstring + Returns whether the legend should automatically resize to fit its contents. +.. seealso:: setResizeToContents() +.. versionadded:: 3.0 + :rtype: bool +%End + - //! @note added in 2.6 QgsLegendModel *model(); +%Docstring + Returns the legend model + :rtype: QgsLegendModel +%End - //! @note added in 2.6 void setAutoUpdateModel( bool autoUpdate ); - //! @note added in 2.6 +%Docstring +.. versionadded:: 2.6 +%End bool autoUpdateModel() const; +%Docstring +.. versionadded:: 2.6 + :rtype: bool +%End - //! Set whether legend items should be filtered to show just the ones visible in the associated map - //! @note added in 2.6 void setLegendFilterByMapEnabled( bool enabled ); - //! Find out whether legend items are filtered to show just the ones visible in the associated map - //! @note added in 2.6 +%Docstring +.. versionadded:: 2.6 +%End bool legendFilterByMapEnabled() const; +%Docstring +.. versionadded:: 2.6 + :rtype: bool +%End - //! Update() overloading. Use it rather than update() - //! @note added in 2.12 virtual void updateItem(); +%Docstring +.. versionadded:: 2.12 +%End - //! When set to true, during an atlas rendering, it will filter out legend elements - //! where features are outside the current atlas feature. - //! @note added in 2.14 void setLegendFilterOutAtlas( bool doFilter ); +%Docstring +.. versionadded:: 2.14 +%End - //! Whether to filter out legend elements outside of the current atlas feature - //! @see setLegendFilterOutAtlas() - //! @note added in 2.14 bool legendFilterOutAtlas() const; +%Docstring +.. versionadded:: 2.14 + :rtype: bool +%End - //setters and getters void setTitle( const QString &t ); QString title() const; +%Docstring + :rtype: str +%End - /** Returns the alignment of the legend title - * @returns Qt::AlignmentFlag for the legend title - * @note added in 2.3 - * @see setTitleAlignment - */ Qt::AlignmentFlag titleAlignment() const; - /** Sets the alignment of the legend title - * @param alignment Text alignment for drawing the legend title - * @note added in 2.3 - * @see titleAlignment - */ - void setTitleAlignment( Qt::AlignmentFlag alignment ); +%Docstring + Returns the alignment of the legend title + :return: Qt.AlignmentFlag for the legend title +.. versionadded:: 2.3 +.. seealso:: setTitleAlignment + :rtype: Qt.AlignmentFlag +%End + + void setTitleAlignment( Qt::AlignmentFlag alignment ); +%Docstring + Sets the alignment of the legend title + \param alignment Text alignment for drawing the legend title +.. versionadded:: 2.3 +.. seealso:: titleAlignment +%End - /** Returns reference to modifiable style */ QgsLegendStyle &rstyle( QgsLegendStyle::Style s ); - /** Returns style */ +%Docstring +Returns reference to modifiable style + :rtype: QgsLegendStyle +%End QgsLegendStyle style( QgsLegendStyle::Style s ) const; +%Docstring +Returns style + :rtype: QgsLegendStyle +%End void setStyle( QgsLegendStyle::Style s, const QgsLegendStyle &style ); QFont styleFont( QgsLegendStyle::Style s ) const; - /** Set style font */ +%Docstring + :rtype: QFont +%End void setStyleFont( QgsLegendStyle::Style s, const QFont &f ); +%Docstring +Set style font +%End - /** Set style margin*/ void setStyleMargin( QgsLegendStyle::Style s, double margin ); +%Docstring +Set style margin +%End void setStyleMargin( QgsLegendStyle::Style s, QgsLegendStyle::Side side, double margin ); - /** Returns the spacing in-between lines in mm - * @note added in 3.0 - * @see setLineSpacing - */ double lineSpacing() const; - /** Sets the spacing in-between multiple lines - * @param spacing Double value to use as spacing in between multiple lines - * @note added in 3.0 - * @see lineSpacing - */ +%Docstring + Returns the spacing in-between lines in mm +.. versionadded:: 3.0 +.. seealso:: setLineSpacing + :rtype: float +%End + void setLineSpacing( double spacing ); +%Docstring + Sets the spacing in-between multiple lines + \param spacing Double value to use as spacing in between multiple lines +.. versionadded:: 3.0 +.. seealso:: lineSpacing +%End double boxSpace() const; +%Docstring + :rtype: float +%End void setBoxSpace( double s ); double columnSpace() const; +%Docstring + :rtype: float +%End void setColumnSpace( double s ); QColor fontColor() const; +%Docstring + :rtype: QColor +%End void setFontColor( const QColor &c ); double symbolWidth() const; +%Docstring + :rtype: float +%End void setSymbolWidth( double w ); double symbolHeight() const; +%Docstring + :rtype: float +%End void setSymbolHeight( double h ); double wmsLegendWidth() const; +%Docstring + :rtype: float +%End void setWmsLegendWidth( double w ); double wmsLegendHeight() const; +%Docstring + :rtype: float +%End void setWmsLegendHeight( double h ); void setWrapChar( const QString &t ); QString wrapChar() const; +%Docstring + :rtype: str +%End int columnCount() const; +%Docstring + :rtype: int +%End void setColumnCount( int c ); - int splitLayer() const; + bool splitLayer() const; +%Docstring + :rtype: bool +%End void setSplitLayer( bool s ); - int equalColumnWidth() const; + bool equalColumnWidth() const; +%Docstring + :rtype: bool +%End void setEqualColumnWidth( bool s ); - /** Returns whether a stroke will be drawn around raster symbol items. - * @see setDrawRasterStroke() - * @see rasterStrokeColor() - * @see rasterStrokeWidth() - * @note added in QGIS 2.12 - */ bool drawRasterStroke() const; +%Docstring + Returns whether a stroke will be drawn around raster symbol items. +.. seealso:: setDrawRasterStroke() +.. seealso:: rasterStrokeColor() +.. seealso:: rasterStrokeWidth() +.. versionadded:: 2.12 + :rtype: bool +%End - /** Sets whether a stroke will be drawn around raster symbol items. - * @param enabled set to true to draw borders - * @see drawRasterStroke() - * @see setRasterStrokeColor() - * @see setRasterStrokeWidth() - * @note added in QGIS 2.12 - */ void setDrawRasterStroke( bool enabled ); +%Docstring + Sets whether a stroke will be drawn around raster symbol items. + \param enabled set to true to draw borders +.. seealso:: drawRasterStroke() +.. seealso:: setRasterStrokeColor() +.. seealso:: setRasterStrokeWidth() +.. versionadded:: 2.12 +%End - /** Returns the stroke color for the stroke drawn around raster symbol items. The stroke is - * only drawn if drawRasterStroke() is true. - * @see setRasterStrokeColor() - * @see drawRasterStroke() - * @see rasterStrokeWidth() - * @note added in QGIS 2.12 - */ QColor rasterStrokeColor() const; +%Docstring + Returns the stroke color for the stroke drawn around raster symbol items. The stroke is + only drawn if drawRasterStroke() is true. +.. seealso:: setRasterStrokeColor() +.. seealso:: drawRasterStroke() +.. seealso:: rasterStrokeWidth() +.. versionadded:: 2.12 + :rtype: QColor +%End - /** Sets the stroke color for the stroke drawn around raster symbol items. The stroke is - * only drawn if drawRasterStroke() is true. - * @param color stroke color - * @see rasterStrokeColor() - * @see setDrawRasterStroke() - * @see setRasterStrokeWidth() - * @note added in QGIS 2.12 - */ void setRasterStrokeColor( const QColor &color ); +%Docstring + Sets the stroke color for the stroke drawn around raster symbol items. The stroke is + only drawn if drawRasterStroke() is true. + \param color stroke color +.. seealso:: rasterStrokeColor() +.. seealso:: setDrawRasterStroke() +.. seealso:: setRasterStrokeWidth() +.. versionadded:: 2.12 +%End - /** Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items. The stroke is - * only drawn if drawRasterStroke() is true. - * @see setRasterStrokeWidth() - * @see drawRasterStroke() - * @see rasterStrokeColor() - * @note added in QGIS 2.12 - */ double rasterStrokeWidth() const; +%Docstring + Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items. The stroke is + only drawn if drawRasterStroke() is true. +.. seealso:: setRasterStrokeWidth() +.. seealso:: drawRasterStroke() +.. seealso:: rasterStrokeColor() +.. versionadded:: 2.12 + :rtype: float +%End - /** Sets the stroke width for the stroke drawn around raster symbol items. The stroke is - * only drawn if drawRasterStroke() is true. - * @param width stroke width in millimeters - * @see rasterStrokeWidth() - * @see setDrawRasterStroke() - * @see setRasterStrokeColor() - * @note added in QGIS 2.12 - */ void setRasterStrokeWidth( double width ); +%Docstring + Sets the stroke width for the stroke drawn around raster symbol items. The stroke is + only drawn if drawRasterStroke() is true. + \param width stroke width in millimeters +.. seealso:: rasterStrokeWidth() +.. seealso:: setDrawRasterStroke() +.. seealso:: setRasterStrokeColor() +.. versionadded:: 2.12 +%End void setComposerMap( const QgsComposerMap *map ); const QgsComposerMap *composerMap() const; +%Docstring + :rtype: QgsComposerMap +%End - /** Updates the model and all legend entries*/ void updateLegend(); +%Docstring +Updates the model and all legend entries +%End - /** Stores state in Dom node - * @param elem is Dom element corresponding to 'Composer' tag - * @param doc Dom document - */ - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; - /** Sets state from Dom document - * @param itemElem is Dom node corresponding to item tag - * @param doc is Dom document - */ - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); +%Docstring + Stores state in Dom node + \param elem is Dom element corresponding to 'Composer' tag + \param doc Dom document + :rtype: bool +%End + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + +%Docstring + Sets state from Dom document + \param itemElem is Dom node corresponding to item tag + \param doc is Dom document + :rtype: bool +%End - //Overridden to show legend title virtual QString displayName() const; const QgsLegendSettings &legendSettings() const; +%Docstring + Returns the legend's renderer settings object. +.. versionadded:: 3.0 + :rtype: QgsLegendSettings +%End public slots: - /** Data changed*/ void synchronizeWithModel(); - /** Sets mCompositionMap to 0 if the map is deleted*/ +%Docstring +Data changed +%End void invalidateCurrentMap(); +%Docstring +Sets mCompositionMap to 0 if the map is deleted +%End + virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = 0 ); + }; + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposerlegend.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposermapgrid.sip b/python/core/composer/qgscomposermapgrid.sip index bfed3ca68fb..d6707281145 100644 --- a/python/core/composer/qgscomposermapgrid.sip +++ b/python/core/composer/qgscomposermapgrid.sip @@ -1,799 +1,894 @@ -/** \ingroup core - * \class QgsComposerMapGridStack - * \brief A collection of grids which is drawn above the map content in a - * QgsComposerMap. The grid stack controls which grids are drawn and the - * order they are drawn in. - * \note added in QGIS 2.5 - * \see QgsComposerMapGrid - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapgrid.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + class QgsComposerMapGridStack : QgsComposerMapItemStack { -%TypeHeaderCode -#include +%Docstring + A collection of grids which is drawn above the map content in a + QgsComposerMap. The grid stack controls which grids are drawn and the + order they are drawn in. +.. versionadded:: 2.5 +.. seealso:: QgsComposerMapGrid %End +%TypeHeaderCode +#include "qgscomposermapgrid.h" +%End public: - /** Constructor for QgsComposerMapGridStack. - * @param map QgsComposerMap the grid stack is attached to - */ QgsComposerMapGridStack( QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapGridStack. + \param map QgsComposerMap the grid stack is attached to +%End - virtual ~QgsComposerMapGridStack(); - - /** Adds a new map grid to the stack and takes ownership of the grid. - * The grid will be added to the end of the stack, and rendered - * above any existing map grids already present in the stack. - * @param grid QgsComposerMapGrid to add to the stack - * @note after adding a grid to the stack, updateBoundingRect() and update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see removeGrid - */ void addGrid( QgsComposerMapGrid *grid /Transfer/ ); +%Docstring + Adds a new map grid to the stack and takes ownership of the grid. + The grid will be added to the end of the stack, and rendered + above any existing map grids already present in the stack. + \param grid QgsComposerMapGrid to add to the stack +.. note:: + + after adding a grid to the stack, updateBoundingRect() and update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: removeGrid +%End - /** Removes a grid from the stack and deletes the corresponding QgsComposerMapGrid - * @param gridId id for the QgsComposerMapGrid to remove - * @note after removing a grid from the stack, updateBoundingRect() and update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see addGrid - */ void removeGrid( const QString &gridId ); +%Docstring + Removes a grid from the stack and deletes the corresponding QgsComposerMapGrid + \param gridId id for the QgsComposerMapGrid to remove +.. note:: + + after removing a grid from the stack, updateBoundingRect() and update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: addGrid +%End - /** Moves a grid up the stack, causing it to be rendered above other grids - * @param gridId id for the QgsComposerMapGrid to move up - * @note after moving a grid within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new grid stack order - * @see moveGridDown - */ void moveGridUp( const QString &gridId ); +%Docstring + Moves a grid up the stack, causing it to be rendered above other grids + \param gridId id for the QgsComposerMapGrid to move up +.. note:: + + after moving a grid within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new grid stack order +.. seealso:: moveGridDown +%End - /** Moves a grid down the stack, causing it to be rendered below other grids - * @param gridId id for the QgsComposerMapGrid to move down - * @note after moving a grid within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new grid stack order - * @see moveGridUp - */ void moveGridDown( const QString &gridId ); +%Docstring + Moves a grid down the stack, causing it to be rendered below other grids + \param gridId id for the QgsComposerMapGrid to move down +.. note:: + + after moving a grid within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new grid stack order +.. seealso:: moveGridUp +%End - /** Returns a const reference to a grid within the stack - * @param gridId id for the QgsComposerMapGrid to find - * @returns const reference to grid, if found - * @see grid - */ const QgsComposerMapGrid *constGrid( const QString &gridId ) const; +%Docstring + Returns a const reference to a grid within the stack + \param gridId id for the QgsComposerMapGrid to find + :return: const reference to grid, if found +.. seealso:: grid + :rtype: QgsComposerMapGrid +%End - /** Returns a reference to a grid within the stack - * @param gridId id for the QgsComposerMapGrid to find - * @returns reference to grid if found - * @see constGrid - */ QgsComposerMapGrid *grid( const QString &gridId ) const; +%Docstring + Returns a reference to a grid within the stack + \param gridId id for the QgsComposerMapGrid to find + :return: reference to grid if found +.. seealso:: constGrid + :rtype: QgsComposerMapGrid +%End - /** Returns a reference to a grid within the stack - * @param index grid position in the stack - * @returns reference to grid if found - * @see constGrid - */ QgsComposerMapGrid *grid( const int index ) const; +%Docstring + Returns a reference to a grid within the stack + \param index grid position in the stack + :return: reference to grid if found +.. seealso:: constGrid + :rtype: QgsComposerMapGrid +%End - /** Returns a reference to a grid within the stack - * @param idx grid position in the stack - * @returns reference to grid if found - * @see constGrid - * @see grid - */ QgsComposerMapGrid &operator[]( int idx ); - /** Returns a list of QgsComposerMapGrids contained by the stack - * @returns list of grids - */ - QList< QgsComposerMapGrid* > asList() const; - - /** Sets the grid stack's state from a DOM document - * @param elem is DOM node corresponding to 'a ComposerMap' tag - * @param doc DOM document - * @returns true if read was successful - * @see writeXML - */ - bool readXml( const QDomElement &elem, const QDomDocument &doc ); - - /** Calculates the maximum distance grids within the stack extend - * beyond the QgsComposerMap's item rect - * @returns maximum grid extension - * @see calculateMaxGridExtension() - */ - double maxGridExtension() const; - - /** Calculates the maximum distance grids within the stack extend beyond the - * QgsComposerMap's item rect. This method calculates the distance for each side of the - * map item separately - * @param top storage for top extension - * @param right storage for right extension - * @param bottom storage for bottom extension - * @param left storage for left extension - * @note added in QGIS 2.12 - * @see maxGridExtension() - */ - void calculateMaxGridExtension( double &top, double &right, double &bottom, double &left ) const; -}; - -// -// QgsComposerMapGrid -// - -/** \ingroup core - * \class QgsComposerMapGrid - * \brief An individual grid which is drawn above the map content in a - * QgsComposerMap. - * \note added in QGIS 2.5 - * \see QgsComposerMapGridStack - */ -class QgsComposerMapGrid : QgsComposerMapItem -{ -%TypeHeaderCode -#include + QList< QgsComposerMapGrid * > asList() const; +%Docstring + Returns a list of QgsComposerMapGrids contained by the stack + :return: list of grids + :rtype: list of QgsComposerMapGrid %End + virtual bool readXml( const QDomElement &elem, const QDomDocument &doc ); + +%Docstring + Sets the grid stack's state from a DOM document + \param elem is DOM node corresponding to 'a ComposerMap' tag + \param doc DOM document + :return: true if read was successful +.. seealso:: writeXml + :rtype: bool +%End + + double maxGridExtension() const; +%Docstring + Calculates the maximum distance grids within the stack extend + beyond the QgsComposerMap's item rect + :return: maximum grid extension +.. seealso:: calculateMaxGridExtension() + :rtype: float +%End + + void calculateMaxGridExtension( double &top, double &right, double &bottom, double &left ) const; +%Docstring + Calculates the maximum distance grids within the stack extend beyond the + QgsComposerMap's item rect. This method calculates the distance for each side of the + map item separately + \param top storage for top extension + \param right storage for right extension + \param bottom storage for bottom extension + \param left storage for left extension +.. versionadded:: 2.12 +.. seealso:: maxGridExtension() +%End +}; + + +class QgsComposerMapGrid : QgsComposerMapItem +{ +%Docstring + An individual grid which is drawn above the map content in a + QgsComposerMap. +.. versionadded:: 2.5 +.. seealso:: QgsComposerMapGridStack +%End + +%TypeHeaderCode +#include "qgscomposermapgrid.h" +%End public: - /** Unit for grid values - */ enum GridUnit { - MapUnit, /*!< grid units follow map units */ - MM, /*!< grid units in millimeters */ - CM /*!< grid units in centimeters */ + MapUnit, + MM, + CM }; - /** Grid drawing style - */ enum GridStyle { Solid, - Cross, /*!< draw line crosses at intersections of grid lines */ - Markers, /*!< draw markers at intersections of grid lines */ - FrameAnnotationsOnly /*!< no grid lines over the map, only draw frame and annotations */ + Cross, + Markers, + FrameAnnotationsOnly }; - /** Display settings for grid annotations and frames - */ enum DisplayMode { - ShowAll = 0, /*!< show both latitude and longitude annotations/divisions */ - LatitudeOnly, /*!< show latitude/y annotations/divisions only */ - LongitudeOnly, /*!< show longitude/x annotations/divisions only */ - HideAll /*!< no annotations */ + ShowAll, + LatitudeOnly, + LongitudeOnly, + HideAll }; - /** Position for grid annotations - */ enum AnnotationPosition { - InsideMapFrame = 0, - OutsideMapFrame, /*!< draw annotations outside the map frame */ + InsideMapFrame, + OutsideMapFrame, }; - /** Direction of grid annotations - */ enum AnnotationDirection { - Horizontal = 0, /*!< draw annotations horizontally */ - Vertical, /*!< draw annotations vertically, ascending */ - VerticalDescending, /*!< draw annotations vertically, descending */ - BoundaryDirection /*!< annotations follow the boundary direction */ + Horizontal, + Vertical, + VerticalDescending, + BoundaryDirection }; - /** Format for displaying grid annotations - */ enum AnnotationFormat { - Decimal, /*!< decimal degrees, use - for S/W coordinates */ - DegreeMinute, /*!< degree/minutes, use NSEW suffix */ - DegreeMinuteSecond, /*!< degree/minutes/seconds, use NSEW suffix */ - DecimalWithSuffix, /*!< decimal degrees, use NSEW suffix */ - DegreeMinuteNoSuffix, /*!< degree/minutes, use - for S/W coordinates */ - DegreeMinutePadded, /*!< degree/minutes, with minutes using leading zeros where required */ - DegreeMinuteSecondNoSuffix, /*!< degree/minutes/seconds, use - for S/W coordinates */ - DegreeMinuteSecondPadded, /*!< degree/minutes/seconds, with minutes using leading zeros where required */ - CustomFormat /*!< custom expression-based format */ + Decimal, + DegreeMinute, + DegreeMinuteSecond, + DecimalWithSuffix, + DegreeMinuteNoSuffix, + DegreeMinutePadded, + DegreeMinuteSecondNoSuffix, + DegreeMinuteSecondPadded, + CustomFormat }; - /** Border sides for annotations - */ enum BorderSide { Left, - Right, /*!< right border */ - Bottom, /*!< bottom border */ - Top /*!< top border */ + Right, + Bottom, + Top }; - /** Style for grid frame - */ enum FrameStyle { - NoFrame, /*!< disable grid frame */ - Zebra, /*!< black/white pattern */ - InteriorTicks, /*!< tick markers drawn inside map frame */ - ExteriorTicks, /*!< tick markers drawn outside map frame */ - InteriorExteriorTicks, /*!< tick markers drawn both inside and outside the map frame */ - LineBorder /*!< simple solid line frame */ + NoFrame, + Zebra, + InteriorTicks, + ExteriorTicks, + InteriorExteriorTicks, + LineBorder }; - /** Flags for controlling which side of the map a frame is drawn on - */ enum FrameSideFlag { - FrameLeft, /*!< left side of map */ - FrameRight, /*!< right side of map */ - FrameTop, /*!< top side of map */ - FrameBottom /*!< bottom side of map */ + FrameLeft, + FrameRight, + FrameTop, + FrameBottom }; typedef QFlags FrameSideFlags; - /** Annotation coordinate type - */ + enum AnnotationCoordinate { - Longitude, /*!< coordinate is a longitude value */ - Latitude /*!< coordinate is a latitude value */ + Longitude, + Latitude }; - /** Constructor for QgsComposerMapGrid. - * @param name friendly display name for grid - * @param map QgsComposerMap the grid is attached to - */ QgsComposerMapGrid( const QString &name, QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapGrid. + \param name friendly display name for grid + \param map QgsComposerMap the grid is attached to +%End virtual ~QgsComposerMapGrid(); - /** Draws a grid - * @param painter destination QPainter - */ - void draw( QPainter *painter ); + virtual void draw( QPainter *painter ); - /** Stores grid state in DOM element - * @param elem is DOM element corresponding to a 'ComposerMap' tag - * @param doc DOM document - * @see readXML - */ - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; +%Docstring + Draws a grid + \param painter destination QPainter +%End - /** Sets grid state from a DOM document - * @param itemElem is DOM node corresponding to a 'ComposerMapGrid' tag - * @param doc is DOM document - * @see writeXML - */ - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + +%Docstring + Stores grid state in DOM element + \param elem is DOM element corresponding to a 'ComposerMap' tag + \param doc DOM document +.. seealso:: readXml + :rtype: bool +%End + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + +%Docstring + Sets grid state from a DOM document + \param itemElem is DOM node corresponding to a 'ComposerMapGrid' tag + \param doc is DOM document +.. seealso:: writeXml + :rtype: bool +%End - /** Sets the CRS for the grid. - * @param crs coordinate reference system for grid - * @see crs - */ void setCrs( const QgsCoordinateReferenceSystem &crs ); +%Docstring + Sets the CRS for the grid. + \param crs coordinate reference system for grid +.. seealso:: crs +%End - /** Retrieves the CRS for the grid. - * @returns coordinate reference system for grid - * @see setCrs - */ QgsCoordinateReferenceSystem crs() const; +%Docstring + Retrieves the CRS for the grid. + :return: coordinate reference system for grid +.. seealso:: setCrs + :rtype: QgsCoordinateReferenceSystem +%End - /** Sets the blending mode used for drawing the grid. - * @param mode blending mode for grid - * @see blendMode - */ void setBlendMode( const QPainter::CompositionMode mode ); +%Docstring + Sets the blending mode used for drawing the grid. + \param mode blending mode for grid +.. seealso:: blendMode +%End - /** Retrieves the blending mode used for drawing the grid. - * @returns blending mode for grid - * @see setBlendMode - */ QPainter::CompositionMode blendMode() const; +%Docstring + Retrieves the blending mode used for drawing the grid. + :return: blending mode for grid +.. seealso:: setBlendMode + :rtype: QPainter.CompositionMode +%End + + virtual bool usesAdvancedEffects() const; - bool usesAdvancedEffects() const; - /** Calculates the maximum distance the grid extends beyond the QgsComposerMap's - * item rect - * @returns maximum extension in millimeters - */ double maxExtension(); +%Docstring + Calculates the maximum distance the grid extends beyond the QgsComposerMap's + item rect + :return: maximum extension in millimeters + :rtype: float +%End - /** Calculates the maximum distance the grid extends beyond the - * QgsComposerMap's item rect. This method calculates the distance for each side of the - * map item separately - * @param top storage for top extension - * @param right storage for right extension - * @param bottom storage for bottom extension - * @param left storage for left extension - * @note added in QGIS 2.12 - * @see maxExtension() - */ void calculateMaxExtension( double &top, double &right, double &bottom, double &left ); +%Docstring + Calculates the maximum distance the grid extends beyond the + QgsComposerMap's item rect. This method calculates the distance for each side of the + map item separately + \param top storage for top extension + \param right storage for right extension + \param bottom storage for bottom extension + \param left storage for left extension +.. versionadded:: 2.12 +.. seealso:: maxExtension() +%End - // - // GRID UNITS - // - /** Sets the units to use for grid measurements such as the interval - * and offset for grid lines. - * @param unit unit for grid measurements - * @see units - */ void setUnits( const GridUnit unit ); +%Docstring + Sets the units to use for grid measurements such as the interval + and offset for grid lines. + \param unit unit for grid measurements +.. seealso:: units +%End - /** Gets the units used for grid measurements such as the interval - * and offset for grid lines. - * @returns for grid measurements - * @see setUnits - */ GridUnit units() const; +%Docstring + Gets the units used for grid measurements such as the interval + and offset for grid lines. + :return: for grid measurements +.. seealso:: setUnits + :rtype: GridUnit +%End - /** Sets the interval between grid lines in the x-direction. The units - * are controlled through the setUnits method - * @param interval interval between horizontal grid lines - * @see setIntervalY - * @see intervalX - */ void setIntervalX( const double interval ); +%Docstring + Sets the interval between grid lines in the x-direction. The units + are controlled through the setUnits method + \param interval interval between horizontal grid lines +.. seealso:: setIntervalY +.. seealso:: intervalX +%End - /** Gets the interval between grid lines in the x-direction. The units - * are retrieved through the units() method. - * @returns interval between horizontal grid lines - * @see setIntervalX - * @see intervalY - */ double intervalX() const; +%Docstring + Gets the interval between grid lines in the x-direction. The units + are retrieved through the units() method. + :return: interval between horizontal grid lines +.. seealso:: setIntervalX +.. seealso:: intervalY + :rtype: float +%End - /** Sets the interval between grid lines in the y-direction. The units - * are controlled through the setUnits method - * @param interval interval between vertical grid lines - * @see setIntervalX - * @see intervalY - */ void setIntervalY( const double interval ); +%Docstring + Sets the interval between grid lines in the y-direction. The units + are controlled through the setUnits method + \param interval interval between vertical grid lines +.. seealso:: setIntervalX +.. seealso:: intervalY +%End - /** Gets the interval between grid lines in the y-direction. The units - * are retrieved through the units() method. - * @returns interval between vertical grid lines - * @see setIntervalY - * @see intervalX - */ double intervalY() const; +%Docstring + Gets the interval between grid lines in the y-direction. The units + are retrieved through the units() method. + :return: interval between vertical grid lines +.. seealso:: setIntervalY +.. seealso:: intervalX + :rtype: float +%End - /** Sets the offset for grid lines in the x-direction. The units - * are controlled through the setUnits method - * @param offset offset for horizontal grid lines - * @see setOffsetY - * @see offsetX - */ void setOffsetX( const double offset ); +%Docstring + Sets the offset for grid lines in the x-direction. The units + are controlled through the setUnits method + \param offset offset for horizontal grid lines +.. seealso:: setOffsetY +.. seealso:: offsetX +%End - /** Gets the offset for grid lines in the x-direction. The units - * are retrieved through the units() method. - * @returns offset for horizontal grid lines - * @see setOffsetX - * @see offsetY - */ double offsetX() const; +%Docstring + Gets the offset for grid lines in the x-direction. The units + are retrieved through the units() method. + :return: offset for horizontal grid lines +.. seealso:: setOffsetX +.. seealso:: offsetY + :rtype: float +%End - /** Sets the offset for grid lines in the y-direction. The units - * are controlled through the setUnits method - * @param offset offset for vertical grid lines - * @see setOffsetX - * @see offsetY - */ void setOffsetY( const double offset ); +%Docstring + Sets the offset for grid lines in the y-direction. The units + are controlled through the setUnits method + \param offset offset for vertical grid lines +.. seealso:: setOffsetX +.. seealso:: offsetY +%End - /** Gets the offset for grid lines in the y-direction. The units - * are retrieved through the units() method. - * @returns offset for vertical grid lines - * @see setOffsetY - * @see offsetX - */ double offsetY() const; +%Docstring + Gets the offset for grid lines in the y-direction. The units + are retrieved through the units() method. + :return: offset for vertical grid lines +.. seealso:: setOffsetY +.. seealso:: offsetX + :rtype: float +%End - // - // GRID APPEARANCE - // - /** Sets the grid style, which controls how the grid is drawn - * over the map's contents - * @param style desired grid style - * @see style - */ void setStyle( const GridStyle style ); +%Docstring + Sets the grid style, which controls how the grid is drawn + over the map's contents + \param style desired grid style +.. seealso:: style +%End - /** Gets the grid's style, which controls how the grid is drawn - * over the map's contents - * @returns current grid style - * @see setStyle - */ GridStyle style() const; +%Docstring + Gets the grid's style, which controls how the grid is drawn + over the map's contents + :return: current grid style +.. seealso:: setStyle + :rtype: GridStyle +%End - /** Sets the length of the cross segments drawn for the grid. This is only used for grids - * with QgsComposerMapGrid::Cross styles - * @param length cross length in millimeters - * @see crossLength - */ void setCrossLength( const double length ); +%Docstring + Sets the length of the cross segments drawn for the grid. This is only used for grids + with QgsComposerMapGrid.Cross styles + \param length cross length in millimeters +.. seealso:: crossLength +%End - /** Retrieves the length of the cross segments drawn for the grid. This is only used for grids - * with QgsComposerMapGrid::Cross styles - * @returns cross length in millimeters - * @see setCrossLength - */ double crossLength() const; +%Docstring + Retrieves the length of the cross segments drawn for the grid. This is only used for grids + with QgsComposerMapGrid.Cross styles + :return: cross length in millimeters +.. seealso:: setCrossLength + :rtype: float +%End - /** Sets width of grid lines. This is only used for grids with QgsComposerMapGrid::Solid - * or QgsComposerMapGrid::Cross styles. For more control over grid line appearance, use - * setLineSymbol instead. - * @param width grid line width - * @see setLineSymbol - * @see setGridLineColor - */ void setGridLineWidth( const double width ); +%Docstring + Sets width of grid lines. This is only used for grids with QgsComposerMapGrid.Solid + or QgsComposerMapGrid.Cross styles. For more control over grid line appearance, use + setLineSymbol instead. + \param width grid line width +.. seealso:: setLineSymbol +.. seealso:: setGridLineColor +%End - /** Sets color of grid lines. This is only used for grids with QgsComposerMapGrid::Solid - * or QgsComposerMapGrid::Cross styles. For more control over grid line appearance, use - * setLineSymbol instead. - * @param color color of grid lines - * @see setLineSymbol - * @see setGridLineWidth - */ void setGridLineColor( const QColor &color ); +%Docstring + Sets color of grid lines. This is only used for grids with QgsComposerMapGrid.Solid + or QgsComposerMapGrid.Cross styles. For more control over grid line appearance, use + setLineSymbol instead. + \param color color of grid lines +.. seealso:: setLineSymbol +.. seealso:: setGridLineWidth +%End - /** Sets the line symbol used for drawing grid lines. This is only used for grids with - * QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles. - * @param symbol line symbol for grid lines - * @see lineSymbol - * @see setMarkerSymbol - * @see setStyle - */ void setLineSymbol( QgsLineSymbol *symbol /Transfer/ ); +%Docstring + Sets the line symbol used for drawing grid lines. This is only used for grids with + QgsComposerMapGrid.Solid or QgsComposerMapGrid.Cross styles. + \param symbol line symbol for grid lines +.. seealso:: lineSymbol +.. seealso:: setMarkerSymbol +.. seealso:: setStyle +%End - /** Gets the line symbol used for drawing grid lines. This is only used for grids with - * QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles. - * @returns line symbol for grid lines - * @see setLineSymbol - * @see markerSymbol - * @see style - * @note not available in python bindings - */ - // const QgsLineSymbol* lineSymbol() const { return mGridLineSymbol; } - /** Gets the line symbol used for drawing grid lines. This is only used for grids with - * QgsComposerMapGrid::Solid or QgsComposerMapGrid::Cross styles. - * @returns line symbol for grid lines - * @see setLineSymbol - * @see markerSymbol - * @see style - */ QgsLineSymbol *lineSymbol(); +%Docstring + Gets the line symbol used for drawing grid lines. This is only used for grids with + QgsComposerMapGrid.Solid or QgsComposerMapGrid.Cross styles. + :return: line symbol for grid lines +.. seealso:: setLineSymbol +.. seealso:: markerSymbol +.. seealso:: style + :rtype: QgsLineSymbol +%End - /** Sets the marker symbol used for drawing grid points. This is only used for grids with a - * QgsComposerMapGrid::Markers style. - * @param symbol marker symbol for grid intersection points - * @see markerSymbol - * @see setLineSymbol - * @see setStyle - */ - void setMarkerSymbol( QgsMarkerSymbol *symbol /Transfer/); + void setMarkerSymbol( QgsMarkerSymbol *symbol ); +%Docstring + Sets the marker symbol used for drawing grid points. This is only used for grids with a + QgsComposerMapGrid.Markers style. + \param symbol marker symbol for grid intersection points +.. seealso:: markerSymbol +.. seealso:: setLineSymbol +.. seealso:: setStyle +%End - /** Gets the marker symbol used for drawing grid points. This is only used for grids with a - * QgsComposerMapGrid::Markers style. - * @returns marker symbol for grid intersection points - * @see setMarkerSymbol - * @see lineSymbol - * @see style - * @note not available in python bindings - */ - // const QgsMarkerSymbol* markerSymbol() const { return mGridMarkerSymbol; } - /** Gets the marker symbol used for drawing grid points. This is only used for grids with a - * QgsComposerMapGrid::Markers style. - * @returns marker symbol for grid intersection points - * @see setMarkerSymbol - * @see lineSymbol - * @see style - */ QgsMarkerSymbol *markerSymbol(); +%Docstring + Gets the marker symbol used for drawing grid points. This is only used for grids with a + QgsComposerMapGrid.Markers style. + :return: marker symbol for grid intersection points +.. seealso:: setMarkerSymbol +.. seealso:: lineSymbol +.. seealso:: style + :rtype: QgsMarkerSymbol +%End - // - // ANNOTATIONS - // - /** Sets whether annotations should be shown for the grid. - * @param enabled set to true to draw annotations for the grid - * @see annotationEnabled - */ void setAnnotationEnabled( const bool enabled ); +%Docstring + Sets whether annotations should be shown for the grid. + \param enabled set to true to draw annotations for the grid +.. seealso:: annotationEnabled +%End - /** Gets whether annotations are shown for the grid. - * @returns true if annotations are drawn for the grid - * @see setAnnotationEnabled - */ bool annotationEnabled() const; +%Docstring + Gets whether annotations are shown for the grid. + :return: true if annotations are drawn for the grid +.. seealso:: setAnnotationEnabled + :rtype: bool +%End - /** Sets the font used for drawing grid annotations - * @param font font for annotations - * @see annotationFont - */ void setAnnotationFont( const QFont &font ); +%Docstring + Sets the font used for drawing grid annotations + \param font font for annotations +.. seealso:: annotationFont +%End - /** Gets the font used for drawing grid annotations - * @returns font for annotations - * @see setAnnotationFont - */ QFont annotationFont() const; +%Docstring + Gets the font used for drawing grid annotations + :return: font for annotations +.. seealso:: setAnnotationFont + :rtype: QFont +%End - /** Sets the font color used for drawing grid annotations - * @param color font color for annotations - * @see annotationFontColor - */ void setAnnotationFontColor( const QColor &color ); +%Docstring + Sets the font color used for drawing grid annotations + \param color font color for annotations +.. seealso:: annotationFontColor +%End - /** Gets the font color used for drawing grid annotations - * @returns font color for annotations - * @see setAnnotationFontColor - */ QColor annotationFontColor() const; +%Docstring + Gets the font color used for drawing grid annotations + :return: font color for annotations +.. seealso:: setAnnotationFontColor + :rtype: QColor +%End - /** Sets the coordinate precision for grid annotations - * @param precision number of decimal places to show when drawing grid annotations - * @see annotationPrecision - */ void setAnnotationPrecision( const int precision ); +%Docstring + Sets the coordinate precision for grid annotations + \param precision number of decimal places to show when drawing grid annotations +.. seealso:: annotationPrecision +%End - /** Returns the coordinate precision for grid annotations - * @returns number of decimal places shown when drawing grid annotations - * @see setAnnotationPrecision - */ int annotationPrecision() const; +%Docstring + Returns the coordinate precision for grid annotations + :return: number of decimal places shown when drawing grid annotations +.. seealso:: setAnnotationPrecision + :rtype: int +%End - /** Sets what types of grid annotations should be drawn for a specified side of the map frame, - * or whether grid annotations should be disabled for the side. - * @param display display mode for annotations - * @param border side of map for annotations - * @see annotationDisplay - * @note added in QGIS 2.7 - */ void setAnnotationDisplay( const DisplayMode display, const BorderSide border ); +%Docstring + Sets what types of grid annotations should be drawn for a specified side of the map frame, + or whether grid annotations should be disabled for the side. + \param display display mode for annotations + \param border side of map for annotations +.. seealso:: annotationDisplay +.. versionadded:: 2.7 +%End - /** Gets the display mode for the grid annotations on a specified side of the map - * frame. This property also specifies whether annotations have been disabled - * from a side of the map frame. - * @param border side of map for annotations - * @returns display mode for grid annotations - * @see setAnnotationDisplay - * @note added in QGIS 2.7 - */ DisplayMode annotationDisplay( const BorderSide border ) const; +%Docstring + Gets the display mode for the grid annotations on a specified side of the map + frame. This property also specifies whether annotations have been disabled + from a side of the map frame. + \param border side of map for annotations + :return: display mode for grid annotations +.. seealso:: setAnnotationDisplay +.. versionadded:: 2.7 + :rtype: DisplayMode +%End - /** Sets the position for the grid annotations on a specified side of the map - * frame. - * @param position position to draw grid annotations - * @param border side of map for annotations - * @see annotationPosition - */ void setAnnotationPosition( const AnnotationPosition position, const BorderSide border ); +%Docstring + Sets the position for the grid annotations on a specified side of the map + frame. + \param position position to draw grid annotations + \param border side of map for annotations +.. seealso:: annotationPosition +%End - /** Gets the position for the grid annotations on a specified side of the map - * frame. - * @param border side of map for annotations - * @returns position that grid annotations are drawn in - * @see setAnnotationPosition - */ AnnotationPosition annotationPosition( const BorderSide border ) const; +%Docstring + Gets the position for the grid annotations on a specified side of the map + frame. + \param border side of map for annotations + :return: position that grid annotations are drawn in +.. seealso:: setAnnotationPosition + :rtype: AnnotationPosition +%End - /** Sets the distance between the map frame and annotations. Units are in millimeters. - * @param distance margin between map frame and annotations - * @see annotationFrameDistance - */ void setAnnotationFrameDistance( const double distance ); +%Docstring + Sets the distance between the map frame and annotations. Units are in millimeters. + \param distance margin between map frame and annotations +.. seealso:: annotationFrameDistance +%End - /** Gets the distance between the map frame and annotations. Units are in millimeters. - * @returns margin between map frame and annotations - * @see setAnnotationFrameDistance - */ double annotationFrameDistance() const; +%Docstring + Gets the distance between the map frame and annotations. Units are in millimeters. + :return: margin between map frame and annotations +.. seealso:: setAnnotationFrameDistance + :rtype: float +%End - /** Sets the direction for drawing frame annotations. - * @param direction direction for frame annotations - * @param border side of map for annotations - * @see annotationDirection - */ void setAnnotationDirection( const AnnotationDirection direction, const BorderSide border ); +%Docstring + Sets the direction for drawing frame annotations. + \param direction direction for frame annotations + \param border side of map for annotations +.. seealso:: annotationDirection +%End - /** Sets the direction for drawing all frame annotations. - * @param direction direction for frame annotations - * @see annotationDirection - */ void setAnnotationDirection( const AnnotationDirection direction ); +%Docstring + Sets the direction for drawing all frame annotations. + \param direction direction for frame annotations +.. seealso:: annotationDirection +%End - /** Gets the direction for drawing frame annotations. - * @param border side of map for annotations - * @returns direction for frame annotations - * @see setAnnotationDirection - */ AnnotationDirection annotationDirection( const BorderSide border ) const; +%Docstring + Gets the direction for drawing frame annotations. + \param border side of map for annotations + :return: direction for frame annotations +.. seealso:: setAnnotationDirection + :rtype: AnnotationDirection +%End - /** Sets the format for drawing grid annotations. - * @param format format for grid annotations - * @see annotationFormat - */ void setAnnotationFormat( const AnnotationFormat format ); +%Docstring + Sets the format for drawing grid annotations. + \param format format for grid annotations +.. seealso:: annotationFormat +%End - /** Gets the format for drawing grid annotations. - * @returns format for grid annotations - * @see setAnnotationFormat - */ AnnotationFormat annotationFormat() const; +%Docstring + Gets the format for drawing grid annotations. + :return: format for grid annotations +.. seealso:: setAnnotationFormat + :rtype: AnnotationFormat +%End - /** Sets the expression used for drawing grid annotations. This is only used when annotationFormat() - * is QgsComposerMapGrid::CustomFormat. - * @param expression expression for evaluating custom grid annotations - * @see annotationExpression - * @note added in QGIS 2.12 - */ void setAnnotationExpression( const QString &expression ); +%Docstring + Sets the expression used for drawing grid annotations. This is only used when annotationFormat() + is QgsComposerMapGrid.CustomFormat. + \param expression expression for evaluating custom grid annotations +.. seealso:: annotationExpression +.. versionadded:: 2.12 +%End - /** Returns the expression used for drawing grid annotations. This is only used when annotationFormat() - * is QgsComposerMapGrid::CustomFormat. - * @returns expression for evaluating custom grid annotations - * @see setAnnotationExpression - * @note added in QGIS 2.12 - */ QString annotationExpression() const; +%Docstring + Returns the expression used for drawing grid annotations. This is only used when annotationFormat() + is QgsComposerMapGrid.CustomFormat. + :return: expression for evaluating custom grid annotations +.. seealso:: setAnnotationExpression +.. versionadded:: 2.12 + :rtype: str +%End - // - // GRID FRAME - // - /** Sets the grid frame style. - * @param style style for grid frame - * @see frameStyle - */ void setFrameStyle( const FrameStyle style ); +%Docstring + Sets the grid frame style. + \param style style for grid frame +.. seealso:: frameStyle +%End - /** Gets the grid frame style. - * @returns style for grid frame - * @see setFrameStyle - */ FrameStyle frameStyle() const; +%Docstring + Gets the grid frame style. + :return: style for grid frame +.. seealso:: setFrameStyle + :rtype: FrameStyle +%End - /** Sets what type of grid divisions should be used for frames on a specified side of the map. - * @param divisions grid divisions for frame - * @param border side of map for frame - * @see frameDivisions - * @note added in QGIS 2.7 - */ void setFrameDivisions( const DisplayMode divisions, const BorderSide border ); +%Docstring + Sets what type of grid divisions should be used for frames on a specified side of the map. + \param divisions grid divisions for frame + \param border side of map for frame +.. seealso:: frameDivisions +.. versionadded:: 2.7 +%End - /** Gets the type of grid divisions which are used for frames on a specified side of the map. - * @param border side of map for frame - * @returns grid divisions for frame - * @see setFrameDivisions - * @note added in QGIS 2.7 - */ DisplayMode frameDivisions( const BorderSide border ) const; +%Docstring + Gets the type of grid divisions which are used for frames on a specified side of the map. + \param border side of map for frame + :return: grid divisions for frame +.. seealso:: setFrameDivisions +.. versionadded:: 2.7 + :rtype: DisplayMode +%End - /** Sets flags for grid frame sides. Setting these flags controls which sides - * of the map item the grid frame is drawn on. - * @param flags flags for grid frame sides - * @see setFrameSideFlag - * @see frameSideFlags - * @see testFrameSideFlag - */ - void setFrameSideFlags( FrameSideFlags flags ); + void setFrameSideFlags( QgsComposerMapGrid::FrameSideFlags flags ); +%Docstring + Sets flags for grid frame sides. Setting these flags controls which sides + of the map item the grid frame is drawn on. + \param flags flags for grid frame sides +.. seealso:: setFrameSideFlag +.. seealso:: frameSideFlags +.. seealso:: testFrameSideFlag +%End - /** Sets whether the grid frame is drawn for a certain side of the map item. - * @param flag flag for grid frame side - * @param on set to true to draw grid frame on that side of the map - * @see setFrameSideFlags - * @see frameSideFlags - * @see testFrameSideFlag - */ void setFrameSideFlag( const FrameSideFlag flag, bool on = true ); +%Docstring + Sets whether the grid frame is drawn for a certain side of the map item. + \param flag flag for grid frame side + \param on set to true to draw grid frame on that side of the map +.. seealso:: setFrameSideFlags +.. seealso:: frameSideFlags +.. seealso:: testFrameSideFlag +%End - /** Returns the flags which control which sides of the map item the grid frame - * is drawn on. - * @returns flags for side of map grid is drawn on - * @see setFrameSideFlags - * @see setFrameSideFlag - * @see testFrameSideFlag - */ FrameSideFlags frameSideFlags() const; +%Docstring + Returns the flags which control which sides of the map item the grid frame + is drawn on. + :return: flags for side of map grid is drawn on +.. seealso:: setFrameSideFlags +.. seealso:: setFrameSideFlag +.. seealso:: testFrameSideFlag + :rtype: FrameSideFlags +%End - /** Tests whether the grid frame should be drawn on a specified side of the map - * item. - * @param flag flag for grid frame side - * @returns true if grid frame should be drawn for that side of the map - * @see setFrameSideFlags - * @see setFrameSideFlag - * @see frameSideFlags - */ bool testFrameSideFlag( const FrameSideFlag flag ) const; +%Docstring + Tests whether the grid frame should be drawn on a specified side of the map + item. + \param flag flag for grid frame side + :return: true if grid frame should be drawn for that side of the map +.. seealso:: setFrameSideFlags +.. seealso:: setFrameSideFlag +.. seealso:: frameSideFlags + :rtype: bool +%End - /** Sets the grid frame width. This property controls how wide the grid frame is. - * The size of the line outlines drawn in the frame is controlled through the - * setFramePenSize method. - * @param width width of grid frame in millimeters - * @see frameWidth - */ void setFrameWidth( const double width ); +%Docstring + Sets the grid frame width. This property controls how wide the grid frame is. + The size of the line outlines drawn in the frame is controlled through the + setFramePenSize method. + \param width width of grid frame in millimeters +.. seealso:: frameWidth +%End - /** Gets the grid frame width. This property controls how wide the grid frame is. - * The size of the line outlines drawn in the frame can be retrieved via the - * framePenSize method. - * @returns width of grid frame in millimeters - * @see setFrameWidth - */ double frameWidth() const; +%Docstring + Gets the grid frame width. This property controls how wide the grid frame is. + The size of the line outlines drawn in the frame can be retrieved via the + framePenSize method. + :return: width of grid frame in millimeters +.. seealso:: setFrameWidth + :rtype: float +%End - /** Sets the width of the stroke drawn in the grid frame. - * @param width width of grid frame stroke - * @see framePenSize - * @see setFramePenColor - */ void setFramePenSize( const double width ); +%Docstring + Sets the width of the stroke drawn in the grid frame. + \param width width of grid frame stroke +.. seealso:: framePenSize +.. seealso:: setFramePenColor +%End - /** Retrieves the width of the stroke drawn in the grid frame. - * @returns width of grid frame stroke - * @see setFramePenSize - * @see framePenColor - */ double framePenSize() const; +%Docstring + Retrieves the width of the stroke drawn in the grid frame. + :return: width of grid frame stroke +.. seealso:: setFramePenSize +.. seealso:: framePenColor + :rtype: float +%End - /** Sets the color of the stroke drawn in the grid frame. - * @param color color of grid frame stroke - * @see framePenColor - * @see setFramePenSize - * @see setFrameFillColor1 - * @see setFrameFillColor2 - */ void setFramePenColor( const QColor &color ); +%Docstring + Sets the color of the stroke drawn in the grid frame. + \param color color of grid frame stroke +.. seealso:: framePenColor +.. seealso:: setFramePenSize +.. seealso:: setFrameFillColor1 +.. seealso:: setFrameFillColor2 +%End - /** Retrieves the color of the stroke drawn in the grid frame. - * @returns color of grid frame stroke - * @see setFramePenColor - * @see framePenSize - * @see frameFillColor1 - * @see frameFillColor2 - */ QColor framePenColor() const; +%Docstring + Retrieves the color of the stroke drawn in the grid frame. + :return: color of grid frame stroke +.. seealso:: setFramePenColor +.. seealso:: framePenSize +.. seealso:: frameFillColor1 +.. seealso:: frameFillColor2 + :rtype: QColor +%End - /** Sets the first fill color used for the grid frame. - * @param color first fill color for grid frame - * @see frameFillColor1 - * @see setFramePenColor - * @see setFrameFillColor2 - */ void setFrameFillColor1( const QColor &color ); +%Docstring + Sets the first fill color used for the grid frame. + \param color first fill color for grid frame +.. seealso:: frameFillColor1 +.. seealso:: setFramePenColor +.. seealso:: setFrameFillColor2 +%End - /** Retrieves the first fill color for the grid frame. - * @returns first fill color for grid frame - * @see setFrameFillColor1 - * @see framePenColor - * @see frameFillColor2 - */ QColor frameFillColor1() const; +%Docstring + Retrieves the first fill color for the grid frame. + :return: first fill color for grid frame +.. seealso:: setFrameFillColor1 +.. seealso:: framePenColor +.. seealso:: frameFillColor2 + :rtype: QColor +%End - /** Sets the second fill color used for the grid frame. - * @param color second fill color for grid frame - * @see frameFillColor2 - * @see setFramePenColor - * @see setFrameFillColor1 - */ void setFrameFillColor2( const QColor &color ); +%Docstring + Sets the second fill color used for the grid frame. + \param color second fill color for grid frame +.. seealso:: frameFillColor2 +.. seealso:: setFramePenColor +.. seealso:: setFrameFillColor1 +%End - /** Retrieves the second fill color for the grid frame. - * @returns second fill color for grid frame - * @see setFrameFillColor2 - * @see framePenColor - * @see frameFillColor1 - */ QColor frameFillColor2() const; +%Docstring + Retrieves the second fill color for the grid frame. + :return: second fill color for grid frame +.. seealso:: setFrameFillColor2 +.. seealso:: framePenColor +.. seealso:: frameFillColor1 + :rtype: QColor +%End virtual QgsExpressionContext createExpressionContext() const; + public: }; + +QFlags operator|(QgsComposerMapGrid::FrameSideFlag f1, QFlags f2); + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapgrid.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposermapitem.sip b/python/core/composer/qgscomposermapitem.sip index 06f600a981b..623f558796f 100644 --- a/python/core/composer/qgscomposermapitem.sip +++ b/python/core/composer/qgscomposermapitem.sip @@ -1,223 +1,288 @@ -/** \ingroup core - * \class QgsComposerMapItem - * \brief An item which is drawn inside a QgsComposerMap, e.g., a grid or map overview. - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapitem.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + class QgsComposerMapItem : QgsComposerObject { -%TypeHeaderCode -#include +%Docstring + An item which is drawn inside a QgsComposerMap, e.g., a grid or map overview. %End +%TypeHeaderCode +#include "qgscomposermapitem.h" +%End public: - /** Constructor for QgsComposerMapItem. - * @param name friendly display name for item - * @param map QgsComposerMap the item is attached to - */ QgsComposerMapItem( const QString &name, QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapItem. + \param name friendly display name for item + \param map QgsComposerMap the item is attached to +%End - virtual ~QgsComposerMapItem(); - - /** Draws the item on to a painter - * @param painter destination QPainter - */ virtual void draw( QPainter *painter ) = 0; +%Docstring + Draws the item on to a painter + \param painter destination QPainter +%End - /** Stores map item state in DOM element - * @param elem is DOM element corresponding to a 'ComposerMap' tag - * @param doc DOM document - * @see readXML - */ virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; +%Docstring + Stores map item state in DOM element + \param elem is DOM element corresponding to a 'ComposerMap' tag + \param doc DOM document +.. seealso:: readXml + :rtype: bool +%End - /** Sets map item state from a DOM document - * @param itemElem is DOM node corresponding to a 'ComposerMapGrid' tag - * @param doc is DOM document - * @see writeXML - */ virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); +%Docstring + Sets map item state from a DOM document + \param itemElem is DOM node corresponding to a 'ComposerMapGrid' tag + \param doc is DOM document +.. seealso:: writeXml + :rtype: bool +%End - /** Sets composer map for the item - * @param map composer map - * @see composerMap - */ virtual void setComposerMap( QgsComposerMap *map ); +%Docstring + Sets composer map for the item + \param map composer map +.. seealso:: composerMap +%End - /** Get composer map for the item - * @returns composer map - * @see setComposerMap - */ virtual const QgsComposerMap *composerMap() const; +%Docstring + Get composer map for the item + :return: composer map +.. seealso:: setComposerMap + :rtype: QgsComposerMap +%End - /** Get the unique id for the map item - * @returns unique id - */ QString id() const; +%Docstring + Get the unique id for the map item + :return: unique id + :rtype: str +%End - /** Sets the friendly display name for the item - * @param name display name - * @see name - */ virtual void setName( const QString &name ); +%Docstring + Sets the friendly display name for the item + \param name display name +.. seealso:: name +%End - /** Get friendly display name for the item - * @returns display name - * @see setName - */ virtual QString name() const; +%Docstring + Get friendly display name for the item + :return: display name +.. seealso:: setName + :rtype: str +%End - /** Controls whether the item will be drawn - * @param enabled set to true to enable drawing of the item - * @see enabled - */ virtual void setEnabled( const bool enabled ); +%Docstring + Controls whether the item will be drawn + \param enabled set to true to enable drawing of the item +.. seealso:: enabled +%End - /** Returns whether the item will be drawn - * @returns true if item will be drawn on the map - * @see setEnabled - */ virtual bool enabled() const; +%Docstring + Returns whether the item will be drawn + :return: true if item will be drawn on the map +.. seealso:: setEnabled + :rtype: bool +%End - /** Returns true if the item is drawn using advanced effects, such as blend modes. - * @returns true if item uses advanced effects - */ virtual bool usesAdvancedEffects() const; +%Docstring + Returns true if the item is drawn using advanced effects, such as blend modes. + :return: true if item uses advanced effects + :rtype: bool +%End + + protected: + + + + }; -/** \ingroup core - * \class QgsComposerMapItemStack - * \brief A collection of map items which are drawn above the map content in a - * QgsComposerMap. The item stack controls which items are drawn and the - * order they are drawn in. - * \note added in QGIS 2.5 - * \see QgsComposerMapItem - */ class QgsComposerMapItemStack { -%TypeHeaderCode -#include +%Docstring + A collection of map items which are drawn above the map content in a + QgsComposerMap. The item stack controls which items are drawn and the + order they are drawn in. +.. versionadded:: 2.5 +.. seealso:: QgsComposerMapItem %End +%TypeHeaderCode +#include "qgscomposermapitem.h" +%End public: - /** Constructor for QgsComposerMapItemStack. - * @param map QgsComposerMap the item stack is attached to - */ QgsComposerMapItemStack( QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapItemStack. + \param map QgsComposerMap the item stack is attached to +%End virtual ~QgsComposerMapItemStack(); - /** Returns the number of items in the stack - * @returns number of items in the stack - */ int size() const; +%Docstring + Returns the number of items in the stack + :return: number of items in the stack + :rtype: int +%End - /** Stores the state of the item stack in a DOM node - * @param elem is DOM element corresponding to a 'ComposerMap' tag - * @param doc DOM document - * @returns true if write was successful - * @see readXML - */ virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; +%Docstring + Stores the state of the item stack in a DOM node + \param elem is DOM element corresponding to a 'ComposerMap' tag + \param doc DOM document + :return: true if write was successful +.. seealso:: readXml + :rtype: bool +%End - /** Sets the item stack's state from a DOM document - * @param elem is DOM node corresponding to 'a ComposerMap' tag - * @param doc DOM document - * @returns true if read was successful - * @see writeXML - */ virtual bool readXml( const QDomElement &elem, const QDomDocument &doc ) = 0; +%Docstring + Sets the item stack's state from a DOM document + \param elem is DOM node corresponding to 'a ComposerMap' tag + \param doc DOM document + :return: true if read was successful +.. seealso:: writeXml + :rtype: bool +%End - /** Draws the items from the stack on a specified painter - * @param painter destination QPainter - */ void drawItems( QPainter *painter ); +%Docstring + Draws the items from the stack on a specified painter + \param painter destination QPainter +%End - /** Returns whether any items within the stack contain advanced effects, - * such as blending modes - * @returns true if item stack contains advanced effects - */ bool containsAdvancedEffects() const; +%Docstring + Returns whether any items within the stack contain advanced effects, + such as blending modes + :return: true if item stack contains advanced effects + :rtype: bool +%End protected: - /** Adds a new map item to the stack and takes ownership of the item. - * The item will be added to the end of the stack, and rendered - * above any existing map items already present in the stack. - * @param item QgsComposerMapItem to add to the stack - * @note after adding an item to the stack update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see removeItem - */ - void addItem( QgsComposerMapItem *item /Transfer/); + void addItem( QgsComposerMapItem *item ); +%Docstring + Adds a new map item to the stack and takes ownership of the item. + The item will be added to the end of the stack, and rendered + above any existing map items already present in the stack. + \param item QgsComposerMapItem to add to the stack +.. note:: + + after adding an item to the stack update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: removeItem +%End - /** Removes an item from the stack and deletes the corresponding QgsComposerMapItem - * @param itemId id for the QgsComposerMapItem to remove - * @note after removing an item from the stack, update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see addItem - */ void removeItem( const QString &itemId ); +%Docstring + Removes an item from the stack and deletes the corresponding QgsComposerMapItem + \param itemId id for the QgsComposerMapItem to remove +.. note:: + + after removing an item from the stack, update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: addItem +%End - /** Moves an item up the stack, causing it to be rendered above other items - * @param itemId id for the QgsComposerMapItem to move up - * @note after moving an item within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new item stack order - * @see moveItemDown - */ void moveItemUp( const QString &itemId ); +%Docstring + Moves an item up the stack, causing it to be rendered above other items + \param itemId id for the QgsComposerMapItem to move up +.. note:: + + after moving an item within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new item stack order +.. seealso:: moveItemDown +%End - /** Moves an item up the stack, causing it to be rendered above other items - * @param itemId id for the QgsComposerMapItem to move down - * @note after moving an item within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new item stack order - * @see moveItemUp - */ void moveItemDown( const QString &itemId ); +%Docstring + Moves an item up the stack, causing it to be rendered above other items + \param itemId id for the QgsComposerMapItem to move down +.. note:: + + after moving an item within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new item stack order +.. seealso:: moveItemUp +%End - /** Returns a const reference to an item within the stack - * @param itemId id for the QgsComposerMapItem to find - * @returns const reference to item, if found - * @see item - */ const QgsComposerMapItem *constItem( const QString &itemId ) const; +%Docstring + Returns a const reference to an item within the stack + \param itemId id for the QgsComposerMapItem to find + :return: const reference to item, if found +.. seealso:: item + :rtype: QgsComposerMapItem +%End - /** Returns a reference to an item within the stack - * @param itemId id for the QgsComposerMapItem to find - * @returns reference to item if found - * @see constItem - */ QgsComposerMapItem *item( const QString &itemId ) const; +%Docstring + Returns a reference to an item within the stack + \param itemId id for the QgsComposerMapItem to find + :return: reference to item if found +.. seealso:: constItem + :rtype: QgsComposerMapItem +%End - /** Returns a reference to an item within the stack - * @param index item position in the stack - * @returns reference to item if found - * @see constItem - */ QgsComposerMapItem *item( const int index ) const; +%Docstring + Returns a reference to an item within the stack + \param index item position in the stack + :return: reference to item if found +.. seealso:: constItem + :rtype: QgsComposerMapItem +%End - /** Returns a reference to an item within the stack - * @param idx item position in the stack - * @returns reference to item if found - * @see constItem - * @see item - * @note not available in python bindings - */ - // QgsComposerMapItem &operator[]( int idx ); - /** Returns a list of QgsComposerMapItems contained by the stack - * @returns list of items - */ - QList< QgsComposerMapItem* > asList() const; + QList< QgsComposerMapItem * > asList() const; +%Docstring + Returns a list of QgsComposerMapItems contained by the stack + :return: list of items + :rtype: list of QgsComposerMapItem +%End protected: - /** Clears the item stack and deletes all QgsComposerMapItems contained - * by the stack - */ + + void removeItems(); +%Docstring + Clears the item stack and deletes all QgsComposerMapItems contained + by the stack +%End }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapitem.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposermapoverview.sip b/python/core/composer/qgscomposermapoverview.sip index 2ce597aec0e..45e7b69fc33 100644 --- a/python/core/composer/qgscomposermapoverview.sip +++ b/python/core/composer/qgscomposermapoverview.sip @@ -1,224 +1,280 @@ -/** \ingroup core - * \class QgsComposerMapOverviewStack - * \brief A collection of overviews which are drawn above the map content in a - * QgsComposerMap. The overview stack controls which overviews are drawn and the - * order they are drawn in. - * \note added in QGIS 2.5 - * \see QgsComposerMapOverview - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapoverview.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + class QgsComposerMapOverviewStack : QgsComposerMapItemStack { +%Docstring + A collection of overviews which are drawn above the map content in a + QgsComposerMap. The overview stack controls which overviews are drawn and the + order they are drawn in. +.. versionadded:: 2.5 +.. seealso:: QgsComposerMapOverview +%End + %TypeHeaderCode -#include +#include "qgscomposermapoverview.h" %End public: - /** Constructor for QgsComposerMapOverviewStack. - * @param map QgsComposerMap the overview stack is attached to - */ QgsComposerMapOverviewStack( QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapOverviewStack. + \param map QgsComposerMap the overview stack is attached to +%End - virtual ~QgsComposerMapOverviewStack(); - - /** Adds a new map overview to the stack and takes ownership of the overview. - * The overview will be added to the end of the stack, and rendered - * above any existing map overviews already present in the stack. - * @param overview QgsComposerMapOverview to add to the stack - * @note after adding a overview to the stack, update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see removeOverview - */ void addOverview( QgsComposerMapOverview *overview /Transfer/ ); +%Docstring + Adds a new map overview to the stack and takes ownership of the overview. + The overview will be added to the end of the stack, and rendered + above any existing map overviews already present in the stack. + \param overview QgsComposerMapOverview to add to the stack +.. note:: + + after adding a overview to the stack, update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: removeOverview +%End - /** Removes an overview from the stack and deletes the corresponding QgsComposerMapOverview - * @param overviewId id for the QgsComposerMapOverview to remove - * @note after removing an overview from the stack, update() - * should be called for the QgsComposerMap to prevent rendering artifacts - * @see addOverview - */ void removeOverview( const QString &overviewId ); +%Docstring + Removes an overview from the stack and deletes the corresponding QgsComposerMapOverview + \param overviewId id for the QgsComposerMapOverview to remove +.. note:: + + after removing an overview from the stack, update() + should be called for the QgsComposerMap to prevent rendering artifacts +.. seealso:: addOverview +%End - /** Moves an overview up the stack, causing it to be rendered above other overviews - * @param overviewId id for the QgsComposerMapOverview to move up - * @note after moving an overview within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new overview stack order - * @see moveOverviewDown - */ void moveOverviewUp( const QString &overviewId ); +%Docstring + Moves an overview up the stack, causing it to be rendered above other overviews + \param overviewId id for the QgsComposerMapOverview to move up +.. note:: + + after moving an overview within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new overview stack order +.. seealso:: moveOverviewDown +%End - /** Moves an overview down the stack, causing it to be rendered below other overviews - * @param overviewId id for the QgsComposerMapOverview to move down - * @note after moving an overview within the stack, update() should be - * called for the QgsComposerMap to redraw the map with the new overview stack order - * @see moveOverviewUp - */ void moveOverviewDown( const QString &overviewId ); +%Docstring + Moves an overview down the stack, causing it to be rendered below other overviews + \param overviewId id for the QgsComposerMapOverview to move down +.. note:: + + after moving an overview within the stack, update() should be + called for the QgsComposerMap to redraw the map with the new overview stack order +.. seealso:: moveOverviewUp +%End - /** Returns a const reference to an overview within the stack - * @param overviewId id for the QgsComposerMapOverview to find - * @returns const reference to overview, if found - * @see overview - */ const QgsComposerMapOverview *constOverview( const QString &overviewId ) const; +%Docstring + Returns a const reference to an overview within the stack + \param overviewId id for the QgsComposerMapOverview to find + :return: const reference to overview, if found +.. seealso:: overview + :rtype: QgsComposerMapOverview +%End - /** Returns a reference to an overview within the stack - * @param overviewId id for the QgsComposerMapOverview to find - * @returns reference to overview if found - * @see constOverview - */ QgsComposerMapOverview *overview( const QString &overviewId ) const; +%Docstring + Returns a reference to an overview within the stack + \param overviewId id for the QgsComposerMapOverview to find + :return: reference to overview if found +.. seealso:: constOverview + :rtype: QgsComposerMapOverview +%End - /** Returns a reference to an overview within the stack - * @param index overview position in the stack - * @returns reference to overview if found - * @see constOverview - */ QgsComposerMapOverview *overview( const int index ) const; +%Docstring + Returns a reference to an overview within the stack + \param index overview position in the stack + :return: reference to overview if found +.. seealso:: constOverview + :rtype: QgsComposerMapOverview +%End - /** Returns a reference to an overview within the stack - * @param idx overview position in the stack - * @returns reference to overview if found - * @see constOverview - * @see overview - */ QgsComposerMapOverview &operator[]( int idx ); - /** Returns a list of QgsComposerMapOverviews contained by the stack - * @returns list of overviews - */ - QList< QgsComposerMapOverview* > asList() const; + QList< QgsComposerMapOverview * > asList() const; +%Docstring + Returns a list of QgsComposerMapOverviews contained by the stack + :return: list of overviews + :rtype: list of QgsComposerMapOverview +%End - /** Sets the overview stack's state from a DOM document - * @param elem is DOM node corresponding to a 'ComposerMap' tag - * @param doc DOM document - * @returns true if read was successful - * @see writeXML - */ - bool readXml( const QDomElement &elem, const QDomDocument &doc ); + virtual bool readXml( const QDomElement &elem, const QDomDocument &doc ); + +%Docstring + Sets the overview stack's state from a DOM document + \param elem is DOM node corresponding to a 'ComposerMap' tag + \param doc DOM document + :return: true if read was successful +.. seealso:: writeXml + :rtype: bool +%End }; -/** \ingroup core - * \class QgsComposerMapOverview - * \brief An individual overview which is drawn above the map content in a - * QgsComposerMap, and shows the extent of another QgsComposerMap. - * \note added in QGIS 2.5 - * \see QgsComposerMapOverviewStack - */ class QgsComposerMapOverview : QgsComposerMapItem { -%TypeHeaderCode -#include +%Docstring + An individual overview which is drawn above the map content in a + QgsComposerMap, and shows the extent of another QgsComposerMap. +.. versionadded:: 2.5 +.. seealso:: QgsComposerMapOverviewStack %End +%TypeHeaderCode +#include "qgscomposermapoverview.h" +%End public: - /** Constructor for QgsComposerMapOverview. - * @param name friendly display name for overview - * @param map QgsComposerMap the overview is attached to - */ QgsComposerMapOverview( const QString &name, QgsComposerMap *map ); +%Docstring + Constructor for QgsComposerMapOverview. + \param name friendly display name for overview + \param map QgsComposerMap the overview is attached to +%End virtual ~QgsComposerMapOverview(); - /** Draws an overview - * @param painter destination QPainter - */ - void draw( QPainter *painter ); + virtual void draw( QPainter *painter ); - /** Stores overview state in DOM element - * @param elem is DOM element corresponding to a 'ComposerMap' tag - * @param doc DOM document - * @see readXML - */ - bool writeXml( QDomElement &elem, QDomDocument &doc ) const; +%Docstring + Draws an overview + \param painter destination QPainter +%End - /** Sets overview state from a DOM document - * @param itemElem is DOM node corresponding to a 'ComposerMapOverview' tag - * @param doc is DOM document - * @see writeXML - */ - bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const; + +%Docstring + Stores overview state in DOM element + \param elem is DOM element corresponding to a 'ComposerMap' tag + \param doc DOM document +.. seealso:: readXml + :rtype: bool +%End + + virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc ); + +%Docstring + Sets overview state from a DOM document + \param itemElem is DOM node corresponding to a 'ComposerMapOverview' tag + \param doc is DOM document +.. seealso:: writeXml + :rtype: bool +%End + + virtual bool usesAdvancedEffects() const; - bool usesAdvancedEffects() const; - /** Sets overview frame map. - * @param mapId source map id. -1 disables the overview frame - * @see frameMapId - */ void setFrameMap( const int mapId ); +%Docstring + Sets overview frame map. + \param mapId source map id. -1 disables the overview frame +.. seealso:: frameMapId +%End - /** Returns id of source map. - * @returns source map id, or -1 if no source map set - */ int frameMapId() const; +%Docstring + Returns id of source map. + :return: source map id, or -1 if no source map set + :rtype: int +%End - /** Sets the fill symbol used for drawing the overview extent. - * @param symbol fill symbol for overview - * @see frameSymbol - */ void setFrameSymbol( QgsFillSymbol *symbol /Transfer/ ); +%Docstring + Sets the fill symbol used for drawing the overview extent. + \param symbol fill symbol for overview +.. seealso:: frameSymbol +%End - /** Gets the fill symbol used for drawing the overview extent. - * @returns fill symbol for overview - * @see setFrameSymbol - */ QgsFillSymbol *frameSymbol(); +%Docstring + Gets the fill symbol used for drawing the overview extent. + :return: fill symbol for overview +.. seealso:: setFrameSymbol + :rtype: QgsFillSymbol +%End - /** Gets the fill symbol used for drawing the overview extent. - * @returns fill symbol for overview - * @see setFrameSymbol - * @note not available in python bindings - */ - // const QgsFillSymbol* frameSymbol() const { return mFrameSymbol; } - /** Retrieves the blending mode used for drawing the overview. - * @returns blending mode for overview - * @see setBlendMode - */ QPainter::CompositionMode blendMode() const; +%Docstring + Retrieves the blending mode used for drawing the overview. + :return: blending mode for overview +.. seealso:: setBlendMode + :rtype: QPainter.CompositionMode +%End - /** Sets the blending mode used for drawing the overview. - * @param blendMode blending mode for overview - * @see blendMode - */ void setBlendMode( const QPainter::CompositionMode blendMode ); +%Docstring + Sets the blending mode used for drawing the overview. + \param blendMode blending mode for overview +.. seealso:: blendMode +%End - /** Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside - * the extent of the overview map. - * @returns true if overview frame is inverted - * @see setInverted - */ bool inverted() const; +%Docstring + Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside + the extent of the overview map. + :return: true if overview frame is inverted +.. seealso:: setInverted + :rtype: bool +%End - /** Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside - * the extent of the overview map. - * @param inverted set to true if overview frame is to be inverted - * @see inverted - */ void setInverted( const bool inverted ); +%Docstring + Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside + the extent of the overview map. + \param inverted set to true if overview frame is to be inverted +.. seealso:: inverted +%End - /** Returns whether the extent of the map is forced to center on the overview - * @returns true if map will be centered on overview - * @see setCentered - */ bool centered() const; +%Docstring + Returns whether the extent of the map is forced to center on the overview + :return: true if map will be centered on overview +.. seealso:: setCentered + :rtype: bool +%End - /** Sets whether the extent of the map is forced to center on the overview - * @param centered set to true if map will be centered on overview - * @see centered - */ void setCentered( const bool centered ); +%Docstring + Sets whether the extent of the map is forced to center on the overview + \param centered set to true if map will be centered on overview +.. seealso:: centered +%End - /** Reconnects signals for overview map, so that overview correctly follows changes to source - * map's extent - */ void connectSignals(); +%Docstring + Reconnects signals for overview map, so that overview correctly follows changes to source + map's extent +%End public slots: - /** Handles recentering of the map and redrawing of the map's overview - */ void overviewExtentChanged(); +%Docstring + Handles recentering of the map and redrawing of the map's overview +%End }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermapoverview.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposermodel.sip b/python/core/composer/qgscomposermodel.sip index 5de34c915de..28d98b95597 100644 --- a/python/core/composer/qgscomposermodel.sip +++ b/python/core/composer/qgscomposermodel.sip @@ -1,289 +1,363 @@ -/** - * \class QgsComposerModel - * \ingroup core - * - * A model for items attached to a composition. The model also maintains the z-order for the - * composition, and must be notified whenever item stacking changes. - * - * Internally, QgsComposerModel maintains two lists. One contains a complete list of all items for - * the composition, ordered by their position within the z-order stack. This list also contains - * items which have been removed from the composition, so that undo/redo commands can restore - * them to their correct position in the stacking order. - * - * The second list contains only items which are currently displayed in the composition's scene. - * It is used as a cache of the last known stacking order, so that the model can compare the current - * stacking of items in the composition to the last known state, and emit the corresponding signals - * as required. - */ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermodel.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ -class QgsComposerModel : QAbstractItemModel + + + + + +class QgsComposerModel: QAbstractItemModel { +%Docstring + + A model for items attached to a composition. The model also maintains the z-order for the + composition, and must be notified whenever item stacking changes. + + Internally, QgsComposerModel maintains two lists. One contains a complete list of all items for + the composition, ordered by their position within the z-order stack. This list also contains + items which have been removed from the composition, so that undo/redo commands can restore + them to their correct position in the stacking order. + + The second list contains only items which are currently displayed in the composition's scene. + It is used as a cache of the last known stacking order, so that the model can compare the current + stacking of items in the composition to the last known state, and emit the corresponding signals + as required. +%End + %TypeHeaderCode #include "qgscomposermodel.h" %End public: - //! Columns returned by the model enum Columns { - Visibility, /*!< Item visibility check box */ - LockStatus, /*!< Item lock status check box */ - ItemId, /*!< Item ID */ + Visibility, + LockStatus, + ItemId, }; - /** Constructor - * @param composition composition to attach to - * @param parent parent object - */ explicit QgsComposerModel( QgsComposition *composition, QObject *parent /TransferThis/ = 0 ); +%Docstring + Constructor + \param composition composition to attach to + \param parent parent object +%End - ~QgsComposerModel(); + virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; + + virtual QModelIndex parent( const QModelIndex &index ) const; + + virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; + + virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; + + virtual QVariant data( const QModelIndex &index, int role ) const; + + virtual Qt::ItemFlags flags( const QModelIndex &index ) const; + + virtual bool setData( const QModelIndex &index, const QVariant &value, int role ); + + virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + + virtual Qt::DropActions supportedDropActions() const; - //reimplemented QAbstractItemModel methods - QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex &index ) const; - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - int columnCount( const QModelIndex &parent = QModelIndex() ) const; - QVariant data( const QModelIndex &index, int role ) const; - Qt::ItemFlags flags( const QModelIndex &index ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role ); - QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - Qt::DropActions supportedDropActions() const; virtual QStringList mimeTypes() const; virtual QMimeData *mimeData( const QModelIndexList &indexes ) const; - bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); - bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); + virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); + + virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); + - /** Clears all items from z-order list and resets the model - * @note added in QGIS 2.5 - */ void clear(); +%Docstring + Clears all items from z-order list and resets the model +.. versionadded:: 2.5 +%End - /** Returns the size of the z-order list, which includes items which may - * have been removed from the composition. - * @returns size of z-order list - * @note added in QGIS 2.5 - */ int zOrderListSize() const; +%Docstring + Returns the size of the z-order list, which includes items which may + have been removed from the composition. + :return: size of z-order list +.. versionadded:: 2.5 + :rtype: int +%End - /** Rebuilds the z-order list, based on the current stacking of items in the composition. - * This method should be called after adding multiple items to the composition. - * @note added in QGIS 2.5 - */ void rebuildZList(); +%Docstring + Rebuilds the z-order list, based on the current stacking of items in the composition. + This method should be called after adding multiple items to the composition. +.. versionadded:: 2.5 +%End - /** Adds an item to the top of the composition z stack. - * @param item item to add. The item must not already exist in the z-order list. - * @note added in QGIS 2.5 - * @see reorderItemToTop - */ void addItemAtTop( QgsComposerItem *item ); +%Docstring + Adds an item to the top of the composition z stack. + \param item item to add. The item must not already exist in the z-order list. +.. versionadded:: 2.5 +.. seealso:: reorderItemToTop +%End - /** Removes an item from the z-order list. - * @param item item to remove - * @note added in QGIS 2.5 - */ void removeItem( QgsComposerItem *item ); +%Docstring + Removes an item from the z-order list. + \param item item to remove +.. versionadded:: 2.5 +%End - /** Moves an item up the z-order list. - * @param item item to move - * @returns true if item was moved. Returns false if item was not found - * in z-order list or was already at the top of the z-order list. - * @see reorderItemDown - * @see reorderItemToTop - * @see reorderItemToBottom - * @note added in QGIS 2.5 - */ bool reorderItemUp( QgsComposerItem *item ); +%Docstring + Moves an item up the z-order list. + \param item item to move + :return: true if item was moved. Returns false if item was not found + in z-order list or was already at the top of the z-order list. +.. seealso:: reorderItemDown +.. seealso:: reorderItemToTop +.. seealso:: reorderItemToBottom +.. versionadded:: 2.5 + :rtype: bool +%End - /** Moves an item down the z-order list. - * @param item item to move - * @returns true if item was moved. Returns false if item was not found - * in z-order list or was already at the bottom of the z-order list. - * @see reorderItemUp - * @see reorderItemToTop - * @see reorderItemToBottom - * @note added in QGIS 2.5 - */ bool reorderItemDown( QgsComposerItem *item ); +%Docstring + Moves an item down the z-order list. + \param item item to move + :return: true if item was moved. Returns false if item was not found + in z-order list or was already at the bottom of the z-order list. +.. seealso:: reorderItemUp +.. seealso:: reorderItemToTop +.. seealso:: reorderItemToBottom +.. versionadded:: 2.5 + :rtype: bool +%End - /** Moves an item to the top of the z-order list. - * @param item item to move - * @returns true if item was moved. Returns false if item was not found - * in z-order list or was already at the top of the z-order list. - * @see reorderItemUp - * @see reorderItemDown - * @see reorderItemToBottom - * @note added in QGIS 2.5 - */ bool reorderItemToTop( QgsComposerItem *item ); +%Docstring + Moves an item to the top of the z-order list. + \param item item to move + :return: true if item was moved. Returns false if item was not found + in z-order list or was already at the top of the z-order list. +.. seealso:: reorderItemUp +.. seealso:: reorderItemDown +.. seealso:: reorderItemToBottom +.. versionadded:: 2.5 + :rtype: bool +%End - /** Moves an item to the bottom of the z-order list. - * @param item item to move - * @returns true if item was moved. Returns false if item was not found - * in z-order list or was already at the bottom of the z-order list. - * @see reorderItemUp - * @see reorderItemDown - * @see reorderItemToTop - * @note added in QGIS 2.5 - */ bool reorderItemToBottom( QgsComposerItem *item ); +%Docstring + Moves an item to the bottom of the z-order list. + \param item item to move + :return: true if item was moved. Returns false if item was not found + in z-order list or was already at the bottom of the z-order list. +.. seealso:: reorderItemUp +.. seealso:: reorderItemDown +.. seealso:: reorderItemToTop +.. versionadded:: 2.5 + :rtype: bool +%End - /** Finds the next composer item above an item. This method only considers - * items which are currently in the composition, and ignores items which have been - * removed from the composition. - * @param item item to search above - * @returns item above specified item. If no items were found, no item - * will be returned. - * @see getComposerItemBelow - * @note added in QGIS 2.5 - */ QgsComposerItem *getComposerItemAbove( QgsComposerItem *item ) const; +%Docstring + Finds the next composer item above an item. This method only considers + items which are currently in the composition, and ignores items which have been + removed from the composition. + \param item item to search above + :return: item above specified item. If no items were found, no item + will be returned. +.. seealso:: getComposerItemBelow +.. versionadded:: 2.5 + :rtype: QgsComposerItem +%End - /** Finds the next composer item below an item. This method only considers - * items which are currently in the composition, and ignores items which have been - * removed from the composition. - * @param item item to search above - * @returns item below specified item. If no items were found, no item - * will be returned. - * @see getComposerItemAbove - * @note added in QGIS 2.5 - */ QgsComposerItem *getComposerItemBelow( QgsComposerItem *item ) const; +%Docstring + Finds the next composer item below an item. This method only considers + items which are currently in the composition, and ignores items which have been + removed from the composition. + \param item item to search above + :return: item below specified item. If no items were found, no item + will be returned. +.. seealso:: getComposerItemAbove +.. versionadded:: 2.5 + :rtype: QgsComposerItem +%End - /** Returns the item z-order list. This list includes both items currently in the - * composition and items which have been removed from the composition. - * @returns item z-order list - * @note added in QGIS 2.5 - */ QList *zOrderList(); +%Docstring + Returns the item z-order list. This list includes both items currently in the + composition and items which have been removed from the composition. + :return: item z-order list +.. versionadded:: 2.5 + :rtype: list of QgsComposerItem +%End - /** Marks an item as removed from the composition. This must be called whenever an item - * has been removed from the composition. - * @param item to mark as removed from the composition - * @see setItemRestored - * @note added in QGIS 2.5 - */ void setItemRemoved( QgsComposerItem *item ); +%Docstring + Marks an item as removed from the composition. This must be called whenever an item + has been removed from the composition. + \param item to mark as removed from the composition +.. seealso:: setItemRestored +.. versionadded:: 2.5 +%End - /** Restores an item to the composition. This must be called whenever an item removed - * from the composition is restored to the composition. - * @param item to mark as restored to the composition - * @see setItemRemoved - * @note added in QGIS 2.5 - */ void setItemRestored( QgsComposerItem *item ); +%Docstring + Restores an item to the composition. This must be called whenever an item removed + from the composition is restored to the composition. + \param item to mark as restored to the composition +.. seealso:: setItemRemoved +.. versionadded:: 2.5 +%End - /** Must be called when an item's display name is modified - * @param item item to update - * @see updateItemLockStatus - * @see updateItemVisibility - * @see updateItemSelectStatus - * @note added in QGIS 2.5 - */ void updateItemDisplayName( QgsComposerItem *item ); +%Docstring + Must be called when an item's display name is modified + \param item item to update +.. seealso:: updateItemLockStatus +.. seealso:: updateItemVisibility +.. seealso:: updateItemSelectStatus +.. versionadded:: 2.5 +%End - /** Must be called when an item's lock status changes - * @param item item to update - * @see updateItemDisplayName - * @see updateItemVisibility - * @see updateItemSelectStatus - * @note added in QGIS 2.5 - */ void updateItemLockStatus( QgsComposerItem *item ); +%Docstring + Must be called when an item's lock status changes + \param item item to update +.. seealso:: updateItemDisplayName +.. seealso:: updateItemVisibility +.. seealso:: updateItemSelectStatus +.. versionadded:: 2.5 +%End - /** Must be called when an item's visibility changes - * @param item item to update - * @see updateItemDisplayName - * @see updateItemLockStatus - * @see updateItemSelectStatus - * @note added in QGIS 2.5 - */ void updateItemVisibility( QgsComposerItem *item ); +%Docstring + Must be called when an item's visibility changes + \param item item to update +.. seealso:: updateItemDisplayName +.. seealso:: updateItemLockStatus +.. seealso:: updateItemSelectStatus +.. versionadded:: 2.5 +%End - /** Must be called when an item's selection status changes - * @param item item to update - * @see updateItemDisplayName - * @see updateItemVisibility - * @see updateItemLockStatus - * @note added in QGIS 2.5 - */ void updateItemSelectStatus( QgsComposerItem *item ); +%Docstring + Must be called when an item's selection status changes + \param item item to update +.. seealso:: updateItemDisplayName +.. seealso:: updateItemVisibility +.. seealso:: updateItemLockStatus +.. versionadded:: 2.5 +%End - /** Returns the QModelIndex corresponding to a QgsComposerItem, if possible - * @param item QgsComposerItem to find index for - * @param column column number for created QModelIndex - * @returns QModelIndex corresponding to item and specified column - */ QModelIndex indexForItem( QgsComposerItem *item, const int column = 0 ); +%Docstring + Returns the QModelIndex corresponding to a QgsComposerItem, if possible + \param item QgsComposerItem to find index for + \param column column number for created QModelIndex + :return: QModelIndex corresponding to item and specified column + :rtype: QModelIndex +%End public slots: - /** Sets an item as the current selection from a QModelIndex - * @param index QModelIndex of item to set as selected - * @note added in QGIS 2.5 - */ void setSelected( const QModelIndex &index ); +%Docstring + Sets an item as the current selection from a QModelIndex + \param index QModelIndex of item to set as selected +.. versionadded:: 2.5 +%End + + protected: + + + }; -/** - * /class QgsComposerProxyModel - * /ingroup core - * /brief Allows for filtering a QgsComposerModel by item type. - * /note added in 2.16 - */ class QgsComposerProxyModel: QSortFilterProxyModel { +%Docstring + Allows for filtering a QgsComposerModel by item type. +.. versionadded:: 2.16 +%End + %TypeHeaderCode #include "qgscomposermodel.h" %End public: - /** Constructor for QgsComposerProxyModel. - * @param composition composition to attach model to - * @param parent optional parent - */ QgsComposerProxyModel( QgsComposition *composition, QObject *parent /TransferThis/ = 0 ); +%Docstring + Constructor for QgsComposerProxyModel. + \param composition composition to attach model to + \param parent optional parent +%End - /** Returns the current item type filter, or QgsComposerItem::ComposerItem if no - * item type filter is set. - * @see setFilterType() - */ QgsComposerItem::ItemType filterType() const; +%Docstring + Returns the current item type filter, or QgsComposerItem.ComposerItem if no + item type filter is set. +.. seealso:: setFilterType() + :rtype: QgsComposerItem.ItemType +%End - /** Sets the item type filter. Only matching item types will be shown. - * @param itemType type to filter. Set to QgsComposerItem::ComposerItem to show all - * item types. - * @see filterType() - */ void setFilterType( QgsComposerItem::ItemType itemType ); +%Docstring + Sets the item type filter. Only matching item types will be shown. + \param itemType type to filter. Set to QgsComposerItem.ComposerItem to show all + item types. +.. seealso:: filterType() +%End - /** Sets a list of specific items to exclude from the model - * @param exceptList list of items to exclude - * @see exceptedItemList() - */ - void setExceptedItemList( const QList< QgsComposerItem* > &exceptList ); + void setExceptedItemList( const QList< QgsComposerItem * > &exceptList ); +%Docstring + Sets a list of specific items to exclude from the model + \param exceptList list of items to exclude +.. seealso:: exceptedItemList() +%End - /** Returns the list of specific items excluded from the model. - * @see setExceptedItemList() - */ - QList< QgsComposerItem* > exceptedItemList() const; + QList< QgsComposerItem * > exceptedItemList() const; +%Docstring + Returns the list of specific items excluded from the model. +.. seealso:: setExceptedItemList() + :rtype: list of QgsComposerItem +%End - /** Returns the QgsComposerModel used in this proxy model. - */ QgsComposerModel *sourceLayerModel() const; +%Docstring + Returns the QgsComposerModel used in this proxy model. + :rtype: QgsComposerModel +%End - /** Returns the QgsComposerItem corresponding to an index from the source - * QgsComposerModel model. - * @param sourceIndex a QModelIndex - * @returns QgsComposerItem for specified index from QgsComposerModel - */ QgsComposerItem *itemFromSourceIndex( const QModelIndex &sourceIndex ) const; +%Docstring + Returns the QgsComposerItem corresponding to an index from the source + QgsComposerModel model. + \param sourceIndex a QModelIndex + :return: QgsComposerItem for specified index from QgsComposerModel + :rtype: QgsComposerItem +%End protected: - bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const; - bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; + virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const; + + virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; + }; + + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermodel.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/python/core/composer/qgscomposermultiframe.sip b/python/core/composer/qgscomposermultiframe.sip index 275a947457e..51a1a8f34ec 100644 --- a/python/core/composer/qgscomposermultiframe.sip +++ b/python/core/composer/qgscomposermultiframe.sip @@ -1,269 +1,335 @@ +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermultiframe.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ + + + + + %ModuleHeaderCode -// fix to allow compilation with sip 4.7 #include #include #include %End -/** - * \ingroup composer - * \class QgsComposerMultiFrame - * Abstract base class for composer items with the ability to distribute the content to several frames - * (QgsComposerFrame items). - */ class QgsComposerMultiFrame: QgsComposerObject { +%Docstring + Abstract base class for composer items with the ability to distribute the content to several frames + (QgsComposerFrame items). +%End + %TypeHeaderCode -#include +#include "qgscomposermultiframe.h" %End %ConvertToSubClassCode - if (dynamic_cast(sipCpp) != NULL) - sipType = sipType_QgsComposerHtml; - else if (dynamic_cast(sipCpp) != NULL) - sipType = sipType_QgsComposerAttributeTableV2; - else if (dynamic_cast(sipCpp) != NULL) - sipType = sipType_QgsComposerTableV2; - else if (dynamic_cast(sipCpp) != NULL) - sipType = sipType_QgsComposerMultiFrame; - else - sipType = NULL; + if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsComposerHtml; + else if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsComposerAttributeTableV2; + else if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsComposerTableV2; + else if ( dynamic_cast( sipCpp ) != NULL ) + sipType = sipType_QgsComposerMultiFrame; + else + sipType = NULL; %End - public: - /** Specifies the behavior for creating new frames to fit the multiframe's content - */ enum ResizeMode { - UseExistingFrames, /*!< don't automatically create new frames, just use existing frames */ - ExtendToNextPage, /*!< creates new full page frames on the following page(s) until the entire multiframe content is visible */ - RepeatOnEveryPage, /*!< repeats the same frame on every page */ - RepeatUntilFinished /*!< creates new frames with the same position and dimensions as the existing frame on the following page(s), - until the entire multiframe content is visible */ + UseExistingFrames, + ExtendToNextPage, + RepeatOnEveryPage, + RepeatUntilFinished }; - /** Construct a new multiframe item. - * @param c parent composition - * @param createUndoCommands - */ QgsComposerMultiFrame( QgsComposition *c /TransferThis/, bool createUndoCommands ); +%Docstring + Construct a new multiframe item. + \param c parent composition + \param createUndoCommands +%End virtual ~QgsComposerMultiFrame(); - /** Returns the total size of the multiframe's content. - * @returns total size required for content - */ virtual QSizeF totalSize() const = 0; +%Docstring + Returns the total size of the multiframe's content. + :return: total size required for content + :rtype: QSizeF +%End - /** Returns the fixed size for a frame, if desired. If the fixed frame size changes, - * the sizes of all frames can be recalculated by calling recalculateFrameRects(). - * @param frameIndex frame number - * @returns fixed size for frame. If the size has a width or height of 0, then - * the frame size is not fixed in that direction and frames can have variable width - * or height accordingly. - * @note added in version 2.5 - * @see minFrameSize - * @see recalculateFrameRects - */ virtual QSizeF fixedFrameSize( const int frameIndex = -1 ) const; +%Docstring + Returns the fixed size for a frame, if desired. If the fixed frame size changes, + the sizes of all frames can be recalculated by calling recalculateFrameRects(). + \param frameIndex frame number + :return: fixed size for frame. If the size has a width or height of 0, then + the frame size is not fixed in that direction and frames can have variable width + or height accordingly. +.. versionadded:: 2.5 +.. seealso:: minFrameSize +.. seealso:: recalculateFrameRects + :rtype: QSizeF +%End - /** Returns the minimum size for a frames, if desired. If the minimum - * size changes, the sizes of all frames can be recalculated by calling - * recalculateFrameRects(). - * @param frameIndex frame number - * @returns minimum size for frame. If the size has a width or height of 0, then - * the frame size has no minimum in that direction. - * @note added in version 2.5 - * @see fixedFrameSize - * @see recalculateFrameRects - */ virtual QSizeF minFrameSize( const int frameIndex = -1 ) const; +%Docstring + Returns the minimum size for a frames, if desired. If the minimum + size changes, the sizes of all frames can be recalculated by calling + recalculateFrameRects(). + \param frameIndex frame number + :return: minimum size for frame. If the size has a width or height of 0, then + the frame size has no minimum in that direction. +.. versionadded:: 2.5 +.. seealso:: fixedFrameSize +.. seealso:: recalculateFrameRects + :rtype: QSizeF +%End - /** Renders a portion of the multiframe's content into a painter. - * @param painter destination painter - * @param renderExtent visible extent of content to render into the painter. - * @param frameIndex frame number for content - * @note added in version 2.5 - */ virtual void render( QPainter *painter, const QRectF &renderExtent, const int frameIndex ) = 0; +%Docstring + Renders a portion of the multiframe's content into a painter. + \param painter destination painter + \param renderExtent visible extent of content to render into the painter. + \param frameIndex frame number for content +.. versionadded:: 2.5 +%End - /** Adds a frame to the multiframe. - * @param frame frame to add - * @param recalcFrameSizes set to true to force recalculation of all existing frame sizes - * @see removeFrame - */ virtual void addFrame( QgsComposerFrame *frame /Transfer/, bool recalcFrameSizes = true ) = 0; +%Docstring + Adds a frame to the multiframe. + \param frame frame to add + \param recalcFrameSizes set to true to force recalculation of all existing frame sizes +.. seealso:: removeFrame +%End - /** Finds the optimal position to break a frame at. - * @param yPos maximum vertical position for break - * @returns the optimal breakable position which occurs in the multi frame close - * to and before the specified yPos - * @note added in version 2.3 - */ virtual double findNearbyPageBreak( double yPos ); +%Docstring + Finds the optimal position to break a frame at. + \param yPos maximum vertical position for break + :return: the optimal breakable position which occurs in the multi frame close + to and before the specified yPos +.. versionadded:: 2.3 + :rtype: float +%End - /** Removes a frame from the multiframe. This method automatically removes the frame from the - * composition. - * @param i index of frame to remove - * @param removeEmptyPages set to true to remove pages which are empty after the frame is removed - * @see addFrame - * @see deleteFrames - */ void removeFrame( int i, const bool removeEmptyPages = false ); +%Docstring + Removes a frame from the multiframe. This method automatically removes the frame from the + composition. + \param i index of frame to remove + \param removeEmptyPages set to true to remove pages which are empty after the frame is removed +.. seealso:: addFrame +.. seealso:: deleteFrames +%End - /** Removes and deletes all child frames. - * @see removeFrame - */ void deleteFrames(); +%Docstring + Removes and deletes all child frames. +.. seealso:: removeFrame +%End - /** Sets the resize mode for the multiframe, and recalculates frame sizes to match. - * @param mode resize mode - * @see resizeMode - */ void setResizeMode( ResizeMode mode ); +%Docstring + Sets the resize mode for the multiframe, and recalculates frame sizes to match. + \param mode resize mode +.. seealso:: resizeMode +%End - /** Returns the resize mode for the multiframe. - * @returns resize mode - * @see setResizeMode - */ ResizeMode resizeMode() const; +%Docstring + Returns the resize mode for the multiframe. + :return: resize mode +.. seealso:: setResizeMode + :rtype: ResizeMode +%End - /** Stores state information about multiframe in DOM element. Implementations of writeXML - * should also call the _writeXML method to save general multiframe properties. - * @param elem is DOM element - * @param doc is the DOM document - * @param ignoreFrames set to false to avoid writing state information about child frames into DOM - * @see _writeXML - */ virtual bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const = 0; +%Docstring + Stores state information about multiframe in DOM element. Implementations of writeXml + should also call the _writeXML method to save general multiframe properties. + \param elem is DOM element + \param doc is the DOM document + \param ignoreFrames set to false to avoid writing state information about child frames into DOM +.. seealso:: _writeXML + :rtype: bool +%End - /** Stores state information about base multiframe object in DOM element. Implementations of writeXML - * should call this method. - * @param elem is DOM element - * @param doc is the DOM document - * @param ignoreFrames set to false to avoid writing state information about child frames into DOM - * @see writeXML - */ bool _writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const; +%Docstring + Stores state information about base multiframe object in DOM element. Implementations of writeXml + should call this method. + \param elem is DOM element + \param doc is the DOM document + \param ignoreFrames set to false to avoid writing state information about child frames into DOM +.. seealso:: writeXml + :rtype: bool +%End - /** Reads multiframe state information from a DOM element. Implementations of readXML - * should also call the _readXML method to restore general multiframe properties. - * @param itemElem is DOM element - * @param doc is the DOM document - * @param ignoreFrames set to false to avoid read state information about child frames from DOM - * @see _readXML - */ virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ) = 0; +%Docstring + Reads multiframe state information from a DOM element. Implementations of readXml + should also call the _readXML method to restore general multiframe properties. + \param itemElem is DOM element + \param doc is the DOM document + \param ignoreFrames set to false to avoid read state information about child frames from DOM +.. seealso:: _readXML + :rtype: bool +%End - /** Restores state information about base multiframe object from a DOM element. Implementations of readXML - * should call this method. - * @param itemElem is DOM element - * @param doc is the DOM document - * @param ignoreFrames set to false to avoid reading state information about child frames from DOM - * @see readXML - */ bool _readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ); +%Docstring + Restores state information about base multiframe object from a DOM element. Implementations of readXml + should call this method. + \param itemElem is DOM element + \param doc is the DOM document + \param ignoreFrames set to false to avoid reading state information about child frames from DOM +.. seealso:: readXml + :rtype: bool +%End - /** Returns the parent composition for the multiframe. - * @returns composition - */ QgsComposition *composition(); +%Docstring + Returns the parent composition for the multiframe. + :return: composition + :rtype: QgsComposition +%End - /** Returns whether undo commands should be created for interactions with the multiframe. - * @returns true if undo commands should be created - * @see setCreateUndoCommands - */ bool createUndoCommands() const; +%Docstring + Returns whether undo commands should be created for interactions with the multiframe. + :return: true if undo commands should be created +.. seealso:: setCreateUndoCommands + :rtype: bool +%End - /** Sets whether undo commands should be created for interactions with the multiframe. - * @param enabled set to true if undo commands should be created - * @see createUndoCommands - */ void setCreateUndoCommands( bool enabled ); +%Docstring + Sets whether undo commands should be created for interactions with the multiframe. + \param enabled set to true if undo commands should be created +.. seealso:: createUndoCommands +%End - /** Returns the number of frames associated with this multiframe. - * @returns number of child frames - **/ int frameCount() const; +%Docstring + Returns the number of frames associated with this multiframe. + :return: number of child frames +* + :rtype: int +%End - /** Returns a child frame from the multiframe. - * @param i index of frame - * @returns child frame if found - * @see frameIndex - */ - QgsComposerFrame *frame( int i ); + QgsComposerFrame *frame( int i ) const; +%Docstring + Returns a child frame from the multiframe. + \param i index of frame + :return: child frame if found +.. seealso:: frameIndex + :rtype: QgsComposerFrame +%End - /** Returns the index of a frame within the multiframe - * @param frame frame to find index of - * @returns index for frame if found, -1 if frame not found in multiframe - * @note added in version 2.5 - * @see frame - */ int frameIndex( QgsComposerFrame *frame ) const; +%Docstring + Returns the index of a frame within the multiframe + \param frame frame to find index of + :return: index for frame if found, -1 if frame not found in multiframe +.. versionadded:: 2.5 +.. seealso:: frame + :rtype: int +%End - /** Creates a new frame and adds it to the multi frame and composition. - * @param currentFrame an existing QgsComposerFrame from which to copy the size - * and general frame properties (e.g., frame style, background, rendering settings). - * @param pos position of top-left corner of the new frame - * @param size size of the new frame - * @returns new QgsComposerFrame - * @note added in version 2.3 - */ QgsComposerFrame *createNewFrame( QgsComposerFrame *currentFrame, QPointF pos, QSizeF size ); +%Docstring + Creates a new frame and adds it to the multi frame and composition. + \param currentFrame an existing QgsComposerFrame from which to copy the size + and general frame properties (e.g., frame style, background, rendering settings). + \param pos position of top-left corner of the new frame + \param size size of the new frame + :return: new QgsComposerFrame +.. versionadded:: 2.3 + :rtype: QgsComposerFrame +%End - /** Get multiframe display name. - * @returns display name for item - * @note added in version 2.5 - */ virtual QString displayName() const; +%Docstring + Get multiframe display name. + :return: display name for item +.. versionadded:: 2.5 + :rtype: str +%End public slots: - /** Forces a redraw of all child frames. - */ void update(); +%Docstring + Forces a redraw of all child frames. +%End - /** Recalculates the portion of the multiframe item which is shown in each of it's - * component frames. If the resize mode is set to anything but UseExistingFrames then - * this may cause new frames to be added or frames to be removed, in order to fit - * the current size of the multiframe's content. - * @see recalculateFrameRects - */ virtual void recalculateFrameSizes(); +%Docstring + Recalculates the portion of the multiframe item which is shown in each of it's + component frames. If the resize mode is set to anything but UseExistingFrames then + this may cause new frames to be added or frames to be removed, in order to fit + the current size of the multiframe's content. +.. seealso:: recalculateFrameRects +%End - /** Forces a recalculation of all the associated frame's scene rectangles. This - * method is useful for multiframes which implement a minFrameSize() or - * fixedFrameSize() method. - * @note added in version 2.5 - * @see minFrameSize() - * @see fixedFrameSize() - * @see recalculateFrameSizes - */ void recalculateFrameRects(); +%Docstring + Forces a recalculation of all the associated frame's scene rectangles. This + method is useful for multiframes which implement a minFrameSize() or + fixedFrameSize() method. +.. versionadded:: 2.5 +.. seealso:: minFrameSize() +.. seealso:: fixedFrameSize() +.. seealso:: recalculateFrameSizes +%End + + void handleFrameRemoval( QgsComposerItem *item ); +%Docstring + Called before a frame is going to be removed. Updates frame list and recalculates + content of remaining frames. +%End signals: - /** Emitted when the properties of a multi frame have changed, and the GUI item widget - * must be updated. - */ void changed(); +%Docstring + Emitted when the properties of a multi frame have changed, and the GUI item widget + must be updated. +%End - /** Emitted when the contents of the multi frame have changed and the frames - * must be redrawn. - */ void contentsChanged(); +%Docstring + Emitted when the contents of the multi frame have changed and the frames + must be redrawn. +%End + + protected: + + + protected slots: - /** Called before a frame is going to be removed. Updates frame list and recalculates - * content of remaining frames. - */ - void handleFrameRemoval( QgsComposerItem *item ); - - /** Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. - */ void handlePageChange(); +%Docstring + Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. +%End }; + +/************************************************************************ + * This file has been generated automatically from * + * * + * src/core/composer/qgscomposermultiframe.h * + * * + * Do not edit manually ! Edit header and run scripts/sipify.pl again * + ************************************************************************/ diff --git a/src/core/composer/qgscomposeritem.h b/src/core/composer/qgscomposeritem.h index 50ee8ebebc3..3da9ac792a5 100644 --- a/src/core/composer/qgscomposeritem.h +++ b/src/core/composer/qgscomposeritem.h @@ -38,6 +38,7 @@ class QgsComposerEffect; * A item that forms part of a map composition. */ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRectItem +{ #ifdef SIP_RUN #include #include @@ -53,7 +54,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec #include #include #endif -{ + #ifdef SIP_RUN SIP_CONVERT_TO_SUBCLASS_CODE diff --git a/src/core/composer/qgscomposermultiframe.h b/src/core/composer/qgscomposermultiframe.h index 20532f6f78f..f9739723880 100644 --- a/src/core/composer/qgscomposermultiframe.h +++ b/src/core/composer/qgscomposermultiframe.h @@ -31,6 +31,15 @@ class QDomElement; class QRectF; class QPainter; + +#ifdef SIP_RUN +% ModuleHeaderCode +#include +#include +#include +% End +#endif + /** * \ingroup core * \class QgsComposerMultiFrame