From aec03269b9dd020a2ce1d1af8d176498c3ed3e85 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 31 Oct 2017 12:53:59 +1000 Subject: [PATCH] Sip is p****** me off, by refusing to build for unrelated reasons Block a bunch of classes from Python bindings for now until sip gets over itself --- python/core/layout/qgslayout.sip | 21 -- python/core/layout/qgslayoutframe.sip | 96 -------- python/core/layout/qgslayoutitemhtml.sip | 208 ---------------- python/core/layout/qgslayoutmultiframe.sip | 261 --------------------- src/core/layout/qgslayout.h | 3 + src/core/layout/qgslayoutframe.h | 4 + src/core/layout/qgslayoutitemhtml.h | 4 + src/core/layout/qgslayoutmultiframe.h | 5 + 8 files changed, 16 insertions(+), 586 deletions(-) diff --git a/python/core/layout/qgslayout.sip b/python/core/layout/qgslayout.sip index 9138a352d47a..e719af964c47 100644 --- a/python/core/layout/qgslayout.sip +++ b/python/core/layout/qgslayout.sip @@ -379,27 +379,6 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb The item will also be deleted. %End - void addMultiFrame( QgsLayoutMultiFrame *multiFrame /Transfer/ ); -%Docstring - Adds a ``multiFrame`` to the layout. The object is owned by the layout until removeMultiFrame() is called. -.. seealso:: removeMultiFrame() -.. seealso:: multiFrames() -%End - - void removeMultiFrame( QgsLayoutMultiFrame *multiFrame ); -%Docstring - Removes a ``multiFrame`` from the layout (but does not delete it). -.. seealso:: addMultiFrame() -.. seealso:: multiFrames() -%End - - QSet< QgsLayoutMultiFrame * > multiFrames() const; -%Docstring - Returns a list of multi frames contained in the layout. -.. seealso:: addMultiFrame() -.. seealso:: removeMultiFrame() - :rtype: set of QgsLayoutMultiFrame -%End QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const; %Docstring diff --git a/python/core/layout/qgslayoutframe.sip b/python/core/layout/qgslayoutframe.sip index 92d15e2482a7..61aff39c0413 100644 --- a/python/core/layout/qgslayoutframe.sip +++ b/python/core/layout/qgslayoutframe.sip @@ -9,102 +9,6 @@ -class QgsLayoutFrame: QgsLayoutItem -{ -%Docstring - Base class for frame items, which form a layout multiframe item. -.. versionadded:: 3.0 -%End - -%TypeHeaderCode -#include "qgslayoutframe.h" -%End - public: - - QgsLayoutFrame( QgsLayout *layout, QgsLayoutMultiFrame *multiFrame ); -%Docstring - Constructor for QgsLayoutFrame, with the specified parent ``layout`` - and belonging to a ``multiFrame``. -%End - - virtual int type() const; - - virtual QString stringType() const; - - - virtual QString displayName() const; - - - 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 layout units). -.. seealso:: extent() -%End - - QgsLayoutMultiFrame *multiFrame() const; -%Docstring - Returns the parent multiframe for the frame. - :rtype: QgsLayoutMultiFrame -%End - - - QRectF extent() const; -%Docstring - Returns the visible portion of the multi frame's content which - is shown in this frame, in layout units. -.. seealso:: setContentSection() - :rtype: QRectF -%End - - bool hidePageIfEmpty() const; -%Docstring - Returns whether the page should be hidden (ie, not included in layout exports) if this frame is empty - :return: true if page should be hidden if frame is empty -.. seealso:: setHidePageIfEmpty() - :rtype: bool -%End - - void setHidePageIfEmpty( const bool hidePageIfEmpty ); -%Docstring - Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty - \param hidePageIfEmpty set to true if page should be hidden if frame is empty -.. seealso:: hidePageIfEmpty() -%End - - 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 -.. seealso:: setHideBackgroundIfEmpty() - :rtype: bool -%End - - 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 -.. seealso:: hideBackgroundIfEmpty() -%End - - bool isEmpty() const; -%Docstring - Returns whether the frame is empty. -.. seealso:: hidePageIfEmpty() - :rtype: bool -%End - - virtual QgsExpressionContext createExpressionContext() const; - - - protected: - - virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 ); - - void drawFrame( QgsRenderContext &context ); - void drawBackground( QgsRenderContext &context ); - -}; /************************************************************************ * This file has been generated automatically from * diff --git a/python/core/layout/qgslayoutitemhtml.sip b/python/core/layout/qgslayoutitemhtml.sip index 60595baa5634..3531aee60511 100644 --- a/python/core/layout/qgslayoutitemhtml.sip +++ b/python/core/layout/qgslayoutitemhtml.sip @@ -9,214 +9,6 @@ -class QgsLayoutItemHtml: QgsLayoutMultiFrame -{ -%Docstring - A layout multiframe subclass for HTML content. -.. versionadded:: 3.0 -%End - -%TypeHeaderCode -#include "qgslayoutitemhtml.h" -%End - public: - - enum ContentMode - { - Url, - ManualHtml - }; - - QgsLayoutItemHtml( QgsLayout *layout ); -%Docstring - Constructor for QgsLayoutItemHtml, with the specified parent ``layout``. -%End - - ~QgsLayoutItemHtml(); - - void setContentMode( ContentMode mode ); -%Docstring - Sets the source ``mode`` for item's HTML content. -.. seealso:: contentMode() -.. seealso:: setUrl() -.. seealso:: setHtml() -%End - - ContentMode contentMode() const; -%Docstring - Returns the source mode for item's HTML content. -.. seealso:: setContentMode() -.. seealso:: url() -.. seealso:: html() - :rtype: ContentMode -%End - - void setUrl( const QUrl &url ); -%Docstring - Sets the ``url`` for content to display in the item when the item is using - the QgsLayoutItemHtml.Url mode. Content is automatically fetched and the - HTML item refreshed after calling this function. -.. seealso:: url() -.. seealso:: contentMode() -%End - - QUrl url() const; -%Docstring - Returns the URL of the content displayed in the item if the item is using - the QgsLayoutItemHtml.Url mode. -.. seealso:: setUrl() -.. seealso:: contentMode() - :rtype: QUrl -%End - - void setHtml( const QString &html ); -%Docstring - Sets the ``html`` to display in the item when the item is using - the QgsLayoutItemHtml.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. -.. seealso:: html() -.. seealso:: contentMode() -.. seealso:: loadHtml() -%End - - QString html() const; -%Docstring - Returns the HTML source displayed in the item if the item is using - the QgsLayoutItemHtml.ManualHtml mode. -.. seealso:: setHtml() -.. seealso:: contentMode() - :rtype: str -%End - - 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. -.. seealso:: setEvaluateExpressions() - :rtype: bool -%End - - 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. -.. seealso:: evaluateExpressions() -%End - - 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. -.. seealso:: setUseSmartBreaks() - :rtype: bool -%End - - 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. -.. seealso:: useSmartBreaks() -%End - - void setMaxBreakDistance( double distance ); -%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. -.. seealso:: maxBreakDistance() -.. seealso:: setUseSmartBreaks() -%End - - 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. -.. seealso:: setMaxBreakDistance() -.. seealso:: useSmartBreaks() - :rtype: float -%End - - 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. -.. seealso:: userStylesheet() -.. seealso:: setUserStylesheetEnabled() -.. seealso:: loadHtml() -%End - - 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. -.. seealso:: setUserStylesheet() -.. seealso:: userStylesheetEnabled() - :rtype: str -%End - - void setUserStylesheetEnabled( const bool enabled ); -%Docstring - Sets whether user stylesheets are ``enabled`` for the HTML content. -.. seealso:: userStylesheetEnabled() -.. seealso:: setUserStylesheet() -%End - - bool userStylesheetEnabled() const; -%Docstring - Returns whether user stylesheets are enabled for the HTML content. -.. seealso:: setUserStylesheetEnabled() -.. seealso:: userStylesheet() - :rtype: bool -%End - - virtual QString displayName() const; - - virtual QSizeF totalSize() const; - - virtual void render( QgsRenderContext &context, const QRectF &renderExtent, const int frameIndex, - const QStyleOptionGraphicsItem *itemStyle = 0 ); - - virtual bool writeXml( QDomElement &elem, QDomDocument &doc, bool ignoreFrames = false ) const; - - virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames = false ); - - virtual double findNearbyPageBreak( double yPos ); - - - public slots: - - 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 - - virtual void recalculateFrameSizes(); - -%Docstring -Recalculates the frame sizes for the current viewport dimensions -%End - void refreshExpressionContext(); - - void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); - -}; /************************************************************************ * This file has been generated automatically from * diff --git a/python/core/layout/qgslayoutmultiframe.sip b/python/core/layout/qgslayoutmultiframe.sip index d36bfd7155c8..cad52301ac24 100644 --- a/python/core/layout/qgslayoutmultiframe.sip +++ b/python/core/layout/qgslayoutmultiframe.sip @@ -10,267 +10,6 @@ -class QgsLayoutMultiFrame: QgsLayoutObject -{ -%Docstring - Abstract base class for layout items with the ability to distribute the content to - several frames (QgsLayoutFrame items). -.. versionadded:: 3.0 -%End - -%TypeHeaderCode -#include "qgslayoutmultiframe.h" -%End - public: - - enum ResizeMode - { - UseExistingFrames, - ExtendToNextPage, - RepeatOnEveryPage, - RepeatUntilFinished - }; - - QgsLayoutMultiFrame( QgsLayout *layout /TransferThis/ ); -%Docstring - Construct a new multiframe item, attached to the specified ``layout``. -%End - - ~QgsLayoutMultiFrame(); - - virtual QSizeF totalSize() const = 0; -%Docstring - Returns the total size of the multiframe's content, in layout units. - :rtype: QSizeF -%End - - 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. -.. seealso:: minFrameSize() -.. seealso:: recalculateFrameRects() - :rtype: QSizeF -%End - - 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. -.. seealso:: fixedFrameSize() -.. seealso:: recalculateFrameRects() - :rtype: QSizeF -%End - - virtual void render( QgsRenderContext &context, const QRectF &renderExtent, const int frameIndex, - const QStyleOptionGraphicsItem *itemStyle = 0 ) = 0; -%Docstring - Renders a portion of the multiframe's content into a render ``context``. - \param context destination render painter - \param renderExtent visible extent of content to render into the painter. - \param frameIndex frame number for content - \param itemStyle item style options for graphics item rendering -%End - - virtual void addFrame( QgsLayoutFrame *frame /Transfer/, bool recalcFrameSizes = true ); -%Docstring - Adds a ``frame`` to the multiframe. - - If ``recalcFrameSizes`` is set to true, then a recalculation of all existing frame sizes will be forced. - -.. seealso:: removeFrame() -%End - - virtual double findNearbyPageBreak( double yPos ); -%Docstring - Finds the optimal position to break a frame at. - \param yPos maximum vertical position for break, in layout units. - :return: the optimal breakable position which occurs in the multi frame close - to and before the specified yPos - :rtype: float -%End - - void removeFrame( int index, bool removeEmptyPages = false ); -%Docstring - Removes a frame by ``index`` from the multiframe. This method automatically removes the frame from the - layout too. - - If ``removeEmptyPages`` is set to true, then pages which are empty after the frame is removed will - also be removed from the layout. - -.. seealso:: addFrame() -.. seealso:: deleteFrames() -%End - - void deleteFrames(); -%Docstring - Removes and deletes all child frames. -.. seealso:: removeFrame() -%End - - void setResizeMode( ResizeMode mode ); -%Docstring - Sets the resize ``mode`` for the multiframe, and recalculates frame sizes to match. -.. seealso:: resizeMode() -%End - - ResizeMode resizeMode() const; -%Docstring - Returns the resize mode for the multiframe. -.. seealso:: setResizeMode() - :rtype: ResizeMode -%End - - 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 - - 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 - - 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 - - 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 - - - int frameCount() const; -%Docstring - Returns the number of frames associated with this multiframe. -.. seealso:: frames() - :rtype: int -%End - - QgsLayoutFrame *frame( int index ) const; -%Docstring - Returns the child frame at a specified ``index`` from the multiframe. -.. seealso:: frameIndex() - :rtype: QgsLayoutFrame -%End - - int frameIndex( QgsLayoutFrame *frame ) const; -%Docstring - Returns the index of a ``frame`` within the multiframe. - :return: index for frame if found, -1 if frame not found in multiframe -.. seealso:: frame() - :rtype: int -%End - - QgsLayoutFrame *createNewFrame( QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size ); -%Docstring - Creates a new frame and adds it to the multi frame and layout. - \param currentFrame an existing QgsLayoutFrame 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, in layout units - \param size size of the new frame, in layout units - :rtype: QgsLayoutFrame -%End - - virtual QString displayName() const; -%Docstring - Returns the multiframe display name. - :rtype: str -%End - - public slots: - - void update(); -%Docstring - Forces a redraw of all child frames. -%End - - virtual void recalculateFrameSizes(); -%Docstring - Recalculates the portion of the multiframe item which is shown in each of its - 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 - - 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. -.. seealso:: minFrameSize() -.. seealso:: fixedFrameSize() -.. seealso:: recalculateFrameSizes -%End - - signals: - - void changed(); -%Docstring - Emitted when the properties of a multi frame have changed, and the GUI item widget - must be updated. -%End - - void contentsChanged(); -%Docstring - Emitted when the contents of the multi frame have changed and the frames - must be redrawn. -%End - - protected: - - - - protected slots: - - void handlePageChange(); -%Docstring - Adapts to changed number of layout pages if resize type is RepeatOnEveryPage. -%End - - void handleFrameRemoval(); -%Docstring - Called when a frame is removed. Updates frame list and recalculates - content of remaining frames. -%End - - -}; /************************************************************************ * This file has been generated automatically from * diff --git a/src/core/layout/qgslayout.h b/src/core/layout/qgslayout.h index bcf0d93f4f55..79faebed7971 100644 --- a/src/core/layout/qgslayout.h +++ b/src/core/layout/qgslayout.h @@ -429,6 +429,8 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext */ void removeLayoutItem( QgsLayoutItem *item ); +#ifndef SIP_RUN + /** * Adds a \a multiFrame to the layout. The object is owned by the layout until removeMultiFrame() is called. * \see removeMultiFrame() @@ -449,6 +451,7 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext * \see removeMultiFrame() */ QSet< QgsLayoutMultiFrame * > multiFrames() const; +#endif /** * Returns the layout's state encapsulated in a DOM element. diff --git a/src/core/layout/qgslayoutframe.h b/src/core/layout/qgslayoutframe.h index 7fb4a4787036..866b580596d4 100644 --- a/src/core/layout/qgslayoutframe.h +++ b/src/core/layout/qgslayoutframe.h @@ -23,6 +23,8 @@ class QgsLayout; class QgsLayoutMultiFrame; +#ifndef SIP_RUN + /** * \ingroup core * Base class for frame items, which form a layout multiframe item. @@ -132,4 +134,6 @@ class CORE_EXPORT QgsLayoutFrame: public QgsLayoutItem }; +#endif + #endif // QGSLAYOUTFRAME_H diff --git a/src/core/layout/qgslayoutitemhtml.h b/src/core/layout/qgslayoutitemhtml.h index 9f07819799e0..c7c7a8be20d8 100644 --- a/src/core/layout/qgslayoutitemhtml.h +++ b/src/core/layout/qgslayoutitemhtml.h @@ -28,6 +28,8 @@ class QgsVectorLayer; class QgsNetworkContentFetcher; class QgsDistanceArea; +#ifndef SIP_RUN + /** * \ingroup core * A layout multiframe subclass for HTML content. @@ -266,4 +268,6 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame double maxFrameWidth() const; }; +#endif + #endif // QGSLAYOUTITEMHTML_H diff --git a/src/core/layout/qgslayoutmultiframe.h b/src/core/layout/qgslayoutmultiframe.h index e935593d2144..5e28c7f7fd96 100644 --- a/src/core/layout/qgslayoutmultiframe.h +++ b/src/core/layout/qgslayoutmultiframe.h @@ -41,6 +41,9 @@ class QgsRenderContext; * \since QGIS 3.0 */ +// sip crashes out on this file - reexamine after composer removal +#ifndef SIP_RUN + class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject { @@ -301,4 +304,6 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject bool mBlockUpdates = false; }; +#endif + #endif // QGSLAYOUTMULTIFRAME_H