mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
sipify core composer part 4
This commit is contained in:
parent
c9a75090bc
commit
eddd258725
@ -1,14 +1,5 @@
|
|||||||
core/conversions.sip
|
core/conversions.sip
|
||||||
core/qgsexception.sip
|
core/qgsexception.sip
|
||||||
core/composer/qgscomposerutils.sip
|
|
||||||
core/composer/qgscomposition.sip
|
|
||||||
core/composer/qgsdoubleboxscalebarstyle.sip
|
|
||||||
core/composer/qgslayoutmanager.sip
|
|
||||||
core/composer/qgsnumericscalebarstyle.sip
|
|
||||||
core/composer/qgspaperitem.sip
|
|
||||||
core/composer/qgsscalebarstyle.sip
|
|
||||||
core/composer/qgssingleboxscalebarstyle.sip
|
|
||||||
core/composer/qgsticksscalebarstyle.sip
|
|
||||||
analysis/vector/qgsgeometryanalyzer.sip
|
analysis/vector/qgsgeometryanalyzer.sip
|
||||||
analysis/vector/qgsgeometrysnapper.sip
|
analysis/vector/qgsgeometrysnapper.sip
|
||||||
analysis/vector/qgspointsample.sip
|
analysis/vector/qgspointsample.sip
|
||||||
|
@ -1,227 +1,305 @@
|
|||||||
/** \ingroup core
|
/************************************************************************
|
||||||
* Utilities for compositions.
|
* This file has been generated automatically from *
|
||||||
*/
|
* *
|
||||||
|
* src/core/composer/qgscomposerutils.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QgsComposerUtils
|
class QgsComposerUtils
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%Docstring
|
||||||
#include <qgscomposerutils.h>
|
Utilities for compositions.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgscomposerutils.h"
|
||||||
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Draws an arrow head on to a QPainter.
|
|
||||||
* @param p destination painter
|
|
||||||
* @param x x-coordinate of arrow center
|
|
||||||
* @param y y-coordinate of arrow center
|
|
||||||
* @param angle angle in degrees which arrow should point toward, measured
|
|
||||||
* clockwise from pointing vertical upward
|
|
||||||
* @param arrowHeadWidth size of arrow head
|
|
||||||
*/
|
|
||||||
static void drawArrowHead( QPainter *p, const double x, const double y, const double angle, const double arrowHeadWidth );
|
static void drawArrowHead( QPainter *p, const double x, const double y, const double angle, const double arrowHeadWidth );
|
||||||
|
%Docstring
|
||||||
|
Draws an arrow head on to a QPainter.
|
||||||
|
\param p destination painter
|
||||||
|
\param x x-coordinate of arrow center
|
||||||
|
\param y y-coordinate of arrow center
|
||||||
|
\param angle angle in degrees which arrow should point toward, measured
|
||||||
|
clockwise from pointing vertical upward
|
||||||
|
\param arrowHeadWidth size of arrow head
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculates the angle of the line from p1 to p2 (counter clockwise,
|
|
||||||
* starting from a line from north to south)
|
|
||||||
* @param p1 start point of line
|
|
||||||
* @param p2 end point of line
|
|
||||||
* @returns angle in degrees, clockwise from south
|
|
||||||
*/
|
|
||||||
static double angle( QPointF p1, QPointF p2 );
|
static double angle( QPointF p1, QPointF p2 );
|
||||||
|
%Docstring
|
||||||
|
Calculates the angle of the line from p1 to p2 (counter clockwise,
|
||||||
|
starting from a line from north to south)
|
||||||
|
\param p1 start point of line
|
||||||
|
\param p2 end point of line
|
||||||
|
:return: angle in degrees, clockwise from south
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Rotates a point / vector around the origin.
|
|
||||||
* @param angle rotation angle in degrees, counterclockwise
|
|
||||||
* @param x in/out: x coordinate before / after the rotation
|
|
||||||
* @param y in/out: y cooreinate before / after the rotation
|
|
||||||
*/
|
|
||||||
static void rotate( const double angle, double &x, double &y );
|
static void rotate( const double angle, double &x, double &y );
|
||||||
|
%Docstring
|
||||||
|
Rotates a point / vector around the origin.
|
||||||
|
\param angle rotation angle in degrees, counterclockwise
|
||||||
|
\param x in/out: x coordinate before / after the rotation
|
||||||
|
\param y in/out: y cooreinate before / after the rotation
|
||||||
|
%End
|
||||||
|
|
||||||
/** Ensures that an angle is in the range 0 <= angle < 360
|
|
||||||
* @param angle angle in degrees
|
|
||||||
* @returns equivalent angle within the range [0, 360)
|
|
||||||
* @see snappedAngle
|
|
||||||
*/
|
|
||||||
static double normalizedAngle( const double angle );
|
static double normalizedAngle( const double angle );
|
||||||
|
%Docstring
|
||||||
|
Ensures that an angle is in the range 0 <= angle < 360
|
||||||
|
\param angle angle in degrees
|
||||||
|
:return: equivalent angle within the range [0, 360)
|
||||||
|
.. seealso:: snappedAngle
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Snaps an angle to its closest 45 degree angle
|
|
||||||
* @param angle angle in degrees
|
|
||||||
* @returns angle snapped to 0, 45/90/135/180/225/270 or 315 degrees
|
|
||||||
*/
|
|
||||||
static double snappedAngle( const double angle );
|
static double snappedAngle( const double angle );
|
||||||
|
%Docstring
|
||||||
|
Snaps an angle to its closest 45 degree angle
|
||||||
|
\param angle angle in degrees
|
||||||
|
:return: angle snapped to 0, 45/90/135/180/225/270 or 315 degrees
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by
|
static QRectF largestRotatedRectWithinBounds( const QRectF &originalRect, const QRectF &boundsRect, const double rotation );
|
||||||
* a specified amount.
|
%Docstring
|
||||||
* @param originalRect QRectF to be rotated and scaled
|
Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by
|
||||||
* @param boundsRect QRectF specifying the bounds which the rotated and scaled rectangle must fit within
|
a specified amount.
|
||||||
* @param rotation the rotation in degrees to be applied to the rectangle
|
\param originalRect QRectF to be rotated and scaled
|
||||||
* @returns largest scaled version of the rectangle possible
|
\param boundsRect QRectF specifying the bounds which the rotated and scaled rectangle must fit within
|
||||||
*/
|
\param rotation the rotation in degrees to be applied to the rectangle
|
||||||
static QRectF largestRotatedRectWithinBounds( const QRectF originalRect, const QRectF boundsRect, const double rotation );
|
:return: largest scaled version of the rectangle possible
|
||||||
|
:rtype: QRectF
|
||||||
|
%End
|
||||||
|
|
||||||
/** Returns the size in mm corresponding to a font point size
|
|
||||||
* @param pointSize font size in points
|
|
||||||
* @see mmToPoints
|
|
||||||
*/
|
|
||||||
static double pointsToMM( const double pointSize );
|
static double pointsToMM( const double pointSize );
|
||||||
|
%Docstring
|
||||||
|
Returns the size in mm corresponding to a font point size
|
||||||
|
\param pointSize font size in points
|
||||||
|
.. seealso:: mmToPoints
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Returns the size in mm corresponding to a font point size
|
|
||||||
* @param mmSize font size in mm
|
|
||||||
* @see pointsToMM
|
|
||||||
*/
|
|
||||||
static double mmToPoints( const double mmSize );
|
static double mmToPoints( const double mmSize );
|
||||||
|
%Docstring
|
||||||
|
Returns the size in mm corresponding to a font point size
|
||||||
|
\param mmSize font size in mm
|
||||||
|
.. seealso:: pointsToMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Resizes a QRectF relative to a resized bounding rectangle.
|
|
||||||
* @param rectToResize QRectF to resize, contained within boundsBefore. The
|
|
||||||
* rectangle is linearly scaled to retain its relative position and size within
|
|
||||||
* boundsAfter.
|
|
||||||
* @param boundsBefore QRectF of bounds before resize
|
|
||||||
* @param boundsAfter QRectF of bounds after resize
|
|
||||||
*/
|
|
||||||
static void relativeResizeRect( QRectF &rectToResize, const QRectF &boundsBefore, const QRectF &boundsAfter );
|
static void relativeResizeRect( QRectF &rectToResize, const QRectF &boundsBefore, const QRectF &boundsAfter );
|
||||||
|
%Docstring
|
||||||
|
Resizes a QRectF relative to a resized bounding rectangle.
|
||||||
|
\param rectToResize QRectF to resize, contained within boundsBefore. The
|
||||||
|
rectangle is linearly scaled to retain its relative position and size within
|
||||||
|
boundsAfter.
|
||||||
|
\param boundsBefore QRectF of bounds before resize
|
||||||
|
\param boundsAfter QRectF of bounds after resize
|
||||||
|
%End
|
||||||
|
|
||||||
/** Returns a scaled position given a before and after range
|
|
||||||
* @param position initial position within before range to scale
|
|
||||||
* @param beforeMin minimum value in before range
|
|
||||||
* @param beforeMax maximum value in before range
|
|
||||||
* @param afterMin minimum value in after range
|
|
||||||
* @param afterMax maximum value in after range
|
|
||||||
* @returns position scaled to range specified by afterMin and afterMax
|
|
||||||
*/
|
|
||||||
static double relativePosition( const double position, const double beforeMin, const double beforeMax, const double afterMin, const double afterMax );
|
static double relativePosition( const double position, const double beforeMin, const double beforeMax, const double afterMin, const double afterMax );
|
||||||
|
%Docstring
|
||||||
|
Returns a scaled position given a before and after range
|
||||||
|
\param position initial position within before range to scale
|
||||||
|
\param beforeMin minimum value in before range
|
||||||
|
\param beforeMax maximum value in before range
|
||||||
|
\param afterMin minimum value in after range
|
||||||
|
\param afterMax maximum value in after range
|
||||||
|
:return: position scaled to range specified by afterMin and afterMax
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Decodes a string representing a paper orientation
|
|
||||||
* @param orientationString string to decode
|
|
||||||
* @param ok will be true if string could be decoded
|
|
||||||
* @returns decoded paper orientation
|
|
||||||
*/
|
|
||||||
static QgsComposition::PaperOrientation decodePaperOrientation( const QString &orientationString, bool &ok );
|
static QgsComposition::PaperOrientation decodePaperOrientation( const QString &orientationString, bool &ok );
|
||||||
|
%Docstring
|
||||||
|
Decodes a string representing a paper orientation
|
||||||
|
\param orientationString string to decode
|
||||||
|
\param ok will be true if string could be decoded
|
||||||
|
:return: decoded paper orientation
|
||||||
|
:rtype: QgsComposition.PaperOrientation
|
||||||
|
%End
|
||||||
|
|
||||||
/** Decodes a string representing a preset page size
|
|
||||||
* @param presetString string to decode
|
|
||||||
* @param width double for decoded paper width
|
|
||||||
* @param height double for decoded paper height
|
|
||||||
* @returns true if string could be decoded successfully
|
|
||||||
*/
|
|
||||||
static bool decodePresetPaperSize( const QString &presetString, double &width, double &height );
|
static bool decodePresetPaperSize( const QString &presetString, double &width, double &height );
|
||||||
|
%Docstring
|
||||||
|
Decodes a string representing a preset page size
|
||||||
|
\param presetString string to decode
|
||||||
|
\param width double for decoded paper width
|
||||||
|
\param height double for decoded paper height
|
||||||
|
:return: true if string could be decoded successfully
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
/** Reads all pre 3.0 data defined properties from an XML element.
|
|
||||||
* @note this method was added in version 3.0
|
|
||||||
* @see readDataDefinedProperty
|
|
||||||
* @see writeDataDefinedPropertyMap
|
|
||||||
*/
|
|
||||||
static void readOldDataDefinedPropertyMap( const QDomElement &itemElem,
|
static void readOldDataDefinedPropertyMap( const QDomElement &itemElem,
|
||||||
QgsPropertyCollection &dataDefinedProperties );
|
QgsPropertyCollection &dataDefinedProperties );
|
||||||
|
%Docstring
|
||||||
|
Reads all pre 3.0 data defined properties from an XML element.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
.. seealso:: readDataDefinedProperty
|
||||||
|
.. seealso:: writeDataDefinedPropertyMap
|
||||||
|
%End
|
||||||
|
|
||||||
/** Reads a pre 3.0 data defined property from an XML DOM element.
|
|
||||||
* @note this method was added in version 3.0
|
|
||||||
* @see readDataDefinedPropertyMap
|
|
||||||
*/
|
|
||||||
static QgsProperty readOldDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, const QDomElement &ddElem );
|
static QgsProperty readOldDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, const QDomElement &ddElem );
|
||||||
|
%Docstring
|
||||||
|
Reads a pre 3.0 data defined property from an XML DOM element.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
.. seealso:: readDataDefinedPropertyMap
|
||||||
|
:rtype: QgsProperty
|
||||||
|
%End
|
||||||
|
|
||||||
/** Returns a font where size is set in pixels and the size has been upscaled with FONT_WORKAROUND_SCALE
|
|
||||||
* to workaround QT font rendering bugs
|
|
||||||
* @param font source font with size set in points
|
|
||||||
* @returns font with size set in pixels
|
|
||||||
* @note added in version 2.5
|
|
||||||
*/
|
|
||||||
static QFont scaledFontPixelSize( const QFont &font );
|
static QFont scaledFontPixelSize( const QFont &font );
|
||||||
|
%Docstring
|
||||||
|
Returns a font where size is set in pixels and the size has been upscaled with FONT_WORKAROUND_SCALE
|
||||||
|
to workaround QT font rendering bugs
|
||||||
|
\param font source font with size set in points
|
||||||
|
:return: font with size set in pixels
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
:rtype: QFont
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font ascent in millimeters, including workarounds for QT font rendering issues
|
|
||||||
* @param font input font
|
|
||||||
* @returns font ascent in millimeters
|
|
||||||
* @note added in version 2.5
|
|
||||||
* @see fontDescentMM
|
|
||||||
* @see fontHeightMM
|
|
||||||
* @see fontHeightCharacterMM
|
|
||||||
* @see textWidthMM
|
|
||||||
*/
|
|
||||||
static double fontAscentMM( const QFont &font );
|
static double fontAscentMM( const QFont &font );
|
||||||
|
%Docstring
|
||||||
|
Calculate font ascent in millimeters, including workarounds for QT font rendering issues
|
||||||
|
\param font input font
|
||||||
|
:return: font ascent in millimeters
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
.. seealso:: fontDescentMM
|
||||||
|
.. seealso:: fontHeightMM
|
||||||
|
.. seealso:: fontHeightCharacterMM
|
||||||
|
.. seealso:: textWidthMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font descent in millimeters, including workarounds for QT font rendering issues
|
|
||||||
* @param font input font
|
|
||||||
* @returns font descent in millimeters
|
|
||||||
* @note added in version 2.5
|
|
||||||
* @see fontAscentMM
|
|
||||||
* @see fontHeightMM
|
|
||||||
* @see fontHeightCharacterMM
|
|
||||||
* @see textWidthMM
|
|
||||||
*/
|
|
||||||
static double fontDescentMM( const QFont &font );
|
static double fontDescentMM( const QFont &font );
|
||||||
|
%Docstring
|
||||||
|
Calculate font descent in millimeters, including workarounds for QT font rendering issues
|
||||||
|
\param font input font
|
||||||
|
:return: font descent in millimeters
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
.. seealso:: fontAscentMM
|
||||||
|
.. seealso:: fontHeightMM
|
||||||
|
.. seealso:: fontHeightCharacterMM
|
||||||
|
.. seealso:: textWidthMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font height in millimeters, including workarounds for QT font rendering issues
|
|
||||||
* The font height is the font ascent + descent + 1 (for the baseline).
|
|
||||||
* @param font input font
|
|
||||||
* @returns font height in millimeters
|
|
||||||
* @note added in version 2.5
|
|
||||||
* @see fontAscentMM
|
|
||||||
* @see fontDescentMM
|
|
||||||
* @see fontHeightCharacterMM
|
|
||||||
* @see textWidthMM
|
|
||||||
*/
|
|
||||||
static double fontHeightMM( const QFont &font );
|
static double fontHeightMM( const QFont &font );
|
||||||
|
%Docstring
|
||||||
|
Calculate font height in millimeters, including workarounds for QT font rendering issues
|
||||||
|
The font height is the font ascent + descent + 1 (for the baseline).
|
||||||
|
\param font input font
|
||||||
|
:return: font height in millimeters
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
.. seealso:: fontAscentMM
|
||||||
|
.. seealso:: fontDescentMM
|
||||||
|
.. seealso:: fontHeightCharacterMM
|
||||||
|
.. seealso:: textWidthMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font height in millimeters of a single character, including workarounds for QT font
|
|
||||||
* rendering issues
|
|
||||||
* @param font input font
|
|
||||||
* @param character character to calculate height for
|
|
||||||
* @returns character height in millimeters
|
|
||||||
* @note added in version 2.5
|
|
||||||
* @see fontAscentMM
|
|
||||||
* @see fontDescentMM
|
|
||||||
* @see fontHeightMM
|
|
||||||
* @see textWidthMM
|
|
||||||
*/
|
|
||||||
static double fontHeightCharacterMM( const QFont &font, QChar character );
|
static double fontHeightCharacterMM( const QFont &font, QChar character );
|
||||||
|
%Docstring
|
||||||
|
Calculate font height in millimeters of a single character, including workarounds for QT font
|
||||||
|
rendering issues
|
||||||
|
\param font input font
|
||||||
|
\param character character to calculate height for
|
||||||
|
:return: character height in millimeters
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
.. seealso:: fontAscentMM
|
||||||
|
.. seealso:: fontDescentMM
|
||||||
|
.. seealso:: fontHeightMM
|
||||||
|
.. seealso:: textWidthMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font width in millimeters for a string, including workarounds for QT font
|
|
||||||
* rendering issues
|
|
||||||
* @param font input font
|
|
||||||
* @param text string to calculate width of
|
|
||||||
* @returns string width in millimeters
|
|
||||||
* @note added in version 2.5
|
|
||||||
* @see fontAscentMM
|
|
||||||
* @see fontDescentMM
|
|
||||||
* @see fontHeightMM
|
|
||||||
* @see fontHeightCharacterMM
|
|
||||||
* @see textHeightMM
|
|
||||||
*/
|
|
||||||
static double textWidthMM( const QFont &font, const QString &text );
|
static double textWidthMM( const QFont &font, const QString &text );
|
||||||
|
%Docstring
|
||||||
|
Calculate font width in millimeters for a string, including workarounds for QT font
|
||||||
|
rendering issues
|
||||||
|
\param font input font
|
||||||
|
\param text string to calculate width of
|
||||||
|
:return: string width in millimeters
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
.. seealso:: fontAscentMM
|
||||||
|
.. seealso:: fontDescentMM
|
||||||
|
.. seealso:: fontHeightMM
|
||||||
|
.. seealso:: fontHeightCharacterMM
|
||||||
|
.. seealso:: textHeightMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Calculate font height in millimeters for a string, including workarounds for QT font
|
|
||||||
* rendering issues. Note that this method uses a non-standard measure of text height,
|
|
||||||
* where only the font ascent is considered for the first line of text.
|
|
||||||
* @param font input font
|
|
||||||
* @param text string to calculate height of
|
|
||||||
* @param multiLineHeight line spacing factor
|
|
||||||
* @returns string height in millimeters
|
|
||||||
* @note added in version 2.12
|
|
||||||
* @see textWidthMM
|
|
||||||
*/
|
|
||||||
static double textHeightMM( const QFont &font, const QString &text, double multiLineHeight = 1.0 );
|
static double textHeightMM( const QFont &font, const QString &text, double multiLineHeight = 1.0 );
|
||||||
|
%Docstring
|
||||||
|
Calculate font height in millimeters for a string, including workarounds for QT font
|
||||||
|
rendering issues. Note that this method uses a non-standard measure of text height,
|
||||||
|
where only the font ascent is considered for the first line of text.
|
||||||
|
\param font input font
|
||||||
|
\param text string to calculate height of
|
||||||
|
\param multiLineHeight line spacing factor
|
||||||
|
:return: string height in millimeters
|
||||||
|
.. versionadded:: 2.12
|
||||||
|
.. seealso:: textWidthMM
|
||||||
|
:rtype: float
|
||||||
|
%End
|
||||||
|
|
||||||
/** Draws text on a painter at a specific position, taking care of composer specific issues (calculation to pixel,
|
|
||||||
* scaling of font and painter to work around Qt font bugs)
|
|
||||||
* @param painter destination QPainter
|
|
||||||
* @param pos position to draw text
|
|
||||||
* @param text string to draw
|
|
||||||
* @param font font to use for drawing text
|
|
||||||
* @param color color to draw text
|
|
||||||
* @note added in version 2.5
|
|
||||||
*/
|
|
||||||
static void drawText( QPainter *painter, QPointF pos, const QString &text, const QFont &font, const QColor &color = QColor() );
|
static void drawText( QPainter *painter, QPointF pos, const QString &text, const QFont &font, const QColor &color = QColor() );
|
||||||
|
%Docstring
|
||||||
|
Draws text on a painter at a specific position, taking care of composer specific issues (calculation to pixel,
|
||||||
|
scaling of font and painter to work around Qt font bugs)
|
||||||
|
\param painter destination QPainter
|
||||||
|
\param pos position to draw text
|
||||||
|
\param text string to draw
|
||||||
|
\param font font to use for drawing text
|
||||||
|
\param color color to draw text
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
%End
|
||||||
|
|
||||||
/** Draws text on a painter within a rectangle, taking care of composer specific issues (calculation to pixel,
|
|
||||||
* scaling of font and painter to work around Qt font bugs)
|
|
||||||
* @param painter destination QPainter
|
|
||||||
* @param rect rectangle to draw into
|
|
||||||
* @param text string to draw
|
|
||||||
* @param font font to use for drawing text
|
|
||||||
* @param color color to draw text
|
|
||||||
* @param halignment optional horizontal alignment
|
|
||||||
* @param valignment optional vertical alignment
|
|
||||||
* @param flags allows for passing Qt::TextFlags to control appearance of rendered text
|
|
||||||
* @note added in version 2.5
|
|
||||||
*/
|
|
||||||
static void drawText( QPainter *painter, const QRectF &rect, const QString &text, const QFont &font, const QColor &color = QColor(), const Qt::AlignmentFlag halignment = Qt::AlignLeft, const Qt::AlignmentFlag valignment = Qt::AlignTop, const int flags = Qt::TextWordWrap );
|
static void drawText( QPainter *painter, const QRectF &rect, const QString &text, const QFont &font, const QColor &color = QColor(), const Qt::AlignmentFlag halignment = Qt::AlignLeft, const Qt::AlignmentFlag valignment = Qt::AlignTop, const int flags = Qt::TextWordWrap );
|
||||||
|
%Docstring
|
||||||
|
Draws text on a painter within a rectangle, taking care of composer specific issues (calculation to pixel,
|
||||||
|
scaling of font and painter to work around Qt font bugs)
|
||||||
|
\param painter destination QPainter
|
||||||
|
\param rect rectangle to draw into
|
||||||
|
\param text string to draw
|
||||||
|
\param font font to use for drawing text
|
||||||
|
\param color color to draw text
|
||||||
|
\param halignment optional horizontal alignment
|
||||||
|
\param valignment optional vertical alignment
|
||||||
|
\param flags allows for passing Qt.TextFlags to control appearance of rendered text
|
||||||
|
.. versionadded:: 2.5
|
||||||
|
%End
|
||||||
|
|
||||||
static QgsRenderContext createRenderContextForMap( QgsComposerMap *map, QPainter *painter, double dpi = -1 );
|
static QgsRenderContext createRenderContextForMap( QgsComposerMap *map, QPainter *painter, double dpi = -1 );
|
||||||
|
%Docstring
|
||||||
|
Creates a render context suitable for the specified composer ``map`` and ``painter`` destination.
|
||||||
|
This method returns a new QgsRenderContext which matches the scale and settings of the
|
||||||
|
target map. If the ``dpi`` argument is not specified then the dpi will be taken from the destinatation
|
||||||
|
painter device.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
.. seealso:: createRenderContextForComposition()
|
||||||
|
:rtype: QgsRenderContext
|
||||||
|
%End
|
||||||
|
|
||||||
static QgsRenderContext createRenderContextForComposition( QgsComposition *composition, QPainter *painter );
|
static QgsRenderContext createRenderContextForComposition( QgsComposition *composition, QPainter *painter );
|
||||||
|
%Docstring
|
||||||
|
Creates a render context suitable for the specified ``composition`` and ``painter`` destination.
|
||||||
|
This method returns a new QgsRenderContext which matches the scale and settings from the composition's
|
||||||
|
QgsComposition.referenceMap().
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
.. seealso:: createRenderContextForMap()
|
||||||
|
:rtype: QgsRenderContext
|
||||||
|
%End
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/composer/qgscomposerutils.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,154 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/composer/qgslayoutmanager.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QgsLayoutManager : QObject
|
class QgsLayoutManager : QObject
|
||||||
{
|
{
|
||||||
|
%Docstring
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
|
||||||
|
Manages storage of a set of compositions.
|
||||||
|
|
||||||
|
QgsLayoutManager handles the storage, serializing and deserializing
|
||||||
|
of QgsCompositions. Usually this class is not constructed directly, but
|
||||||
|
rather accessed through a QgsProject via QgsProject.layoutManager().
|
||||||
|
|
||||||
|
QgsLayoutManager retains ownership of all the compositions contained
|
||||||
|
in the manager.
|
||||||
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include <qgslayoutmanager.h>
|
#include "qgslayoutmanager.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit QgsLayoutManager( QgsProject *project /TransferThis/ = 0 );
|
explicit QgsLayoutManager( QgsProject *project /TransferThis/ = 0 );
|
||||||
|
%Docstring
|
||||||
|
Constructor for QgsLayoutManager. The project will become the parent object for this
|
||||||
|
manager.
|
||||||
|
%End
|
||||||
|
|
||||||
~QgsLayoutManager();
|
~QgsLayoutManager();
|
||||||
|
|
||||||
bool addComposition( QgsComposition *composition /Transfer/ );
|
bool addComposition( QgsComposition *composition /Transfer/ );
|
||||||
|
%Docstring
|
||||||
|
Adds a composition to the manager. Ownership of the composition is transferred to the manager.
|
||||||
|
Returns true if the addition was successful, or false if the composition could not be added (eg
|
||||||
|
as a result of a duplicate composition name).
|
||||||
|
.. seealso:: removeComposition()
|
||||||
|
.. seealso:: compositionAdded()
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
bool removeComposition( QgsComposition *composition );
|
bool removeComposition( QgsComposition *composition );
|
||||||
|
%Docstring
|
||||||
|
Removes a composition from the manager. The composition is deleted.
|
||||||
|
Returns true if the removal was successful, or false if the removal failed (eg as a result
|
||||||
|
of removing a composition which is not contained in the manager).
|
||||||
|
.. seealso:: addComposition()
|
||||||
|
.. seealso:: compositionRemoved()
|
||||||
|
.. seealso:: compositionAboutToBeRemoved()
|
||||||
|
.. seealso:: clear()
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
%Docstring
|
||||||
|
Removes and deletes all compositions from the manager.
|
||||||
|
.. seealso:: removeComposition()
|
||||||
|
%End
|
||||||
|
|
||||||
QList< QgsComposition * > compositions() const;
|
QList< QgsComposition * > compositions() const;
|
||||||
|
%Docstring
|
||||||
|
Returns a list of all compositions contained in the manager.
|
||||||
|
:rtype: list of QgsComposition
|
||||||
|
%End
|
||||||
|
|
||||||
QgsComposition *compositionByName( const QString &name ) const;
|
QgsComposition *compositionByName( const QString &name ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns the composition with a matching name, or None if no matching compositions
|
||||||
|
were found.
|
||||||
|
:rtype: QgsComposition
|
||||||
|
%End
|
||||||
|
|
||||||
bool readXml( const QDomElement &element, const QDomDocument &doc );
|
bool readXml( const QDomElement &element, const QDomDocument &doc );
|
||||||
|
%Docstring
|
||||||
|
Reads the manager's state from a DOM element, restoring all compositions
|
||||||
|
present in the XML document.
|
||||||
|
.. seealso:: writeXml()
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
QDomElement writeXml( QDomDocument &doc ) const;
|
QDomElement writeXml( QDomDocument &doc ) const;
|
||||||
|
%Docstring
|
||||||
|
Returns a DOM element representing the state of the manager.
|
||||||
|
.. seealso:: readXml()
|
||||||
|
:rtype: QDomElement
|
||||||
|
%End
|
||||||
|
|
||||||
bool saveAsTemplate( const QString &name, QDomDocument &doc ) const;
|
bool saveAsTemplate( const QString &name, QDomDocument &doc ) const;
|
||||||
|
%Docstring
|
||||||
|
Saves the composition with matching ``name`` in template format.
|
||||||
|
Returns true if save was successful.
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
QgsComposition *duplicateComposition( const QString &name, const QString &newName );
|
QgsComposition *duplicateComposition( const QString &name, const QString &newName );
|
||||||
|
%Docstring
|
||||||
|
Duplicates an existing composition from the manager. The new
|
||||||
|
composition will automatically be stored in the manager.
|
||||||
|
Returns new composition if duplication was successful.
|
||||||
|
:rtype: QgsComposition
|
||||||
|
%End
|
||||||
|
|
||||||
QString generateUniqueTitle() const;
|
QString generateUniqueTitle() const;
|
||||||
|
%Docstring
|
||||||
|
Generates a unique title for a new composition, which does not
|
||||||
|
clash with any already contained by the manager.
|
||||||
|
:rtype: str
|
||||||
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void compositionAboutToBeAdded( const QString &name );
|
void compositionAboutToBeAdded( const QString &name );
|
||||||
void compositionAdded( const QString &name );
|
%Docstring
|
||||||
void compositionRemoved( const QString &name );
|
Emitted when a composition is about to be added to the manager
|
||||||
void compositionAboutToBeRemoved( const QString &name );
|
%End
|
||||||
void compositionRenamed( QgsComposition *composition, const QString &newName );
|
|
||||||
|
|
||||||
|
void compositionAdded( const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Emitted when a composition has been added to the manager
|
||||||
|
%End
|
||||||
|
|
||||||
|
void compositionRemoved( const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Emitted when a composition was removed from the manager
|
||||||
|
%End
|
||||||
|
|
||||||
|
void compositionAboutToBeRemoved( const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Emitted when a composition is about to be removed from the manager
|
||||||
|
%End
|
||||||
|
|
||||||
|
void compositionRenamed( QgsComposition *composition, const QString &newName );
|
||||||
|
%Docstring
|
||||||
|
Emitted when a composition is renamed
|
||||||
|
%End
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/composer/qgslayoutmanager.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
@ -1,52 +1,87 @@
|
|||||||
/** Item representing a grid. This is drawn separately to the underlying paper item since the grid needs to be
|
/************************************************************************
|
||||||
* drawn above all other composer items, while the paper item is drawn below all others.*/
|
* This file has been generated automatically from *
|
||||||
class QgsPaperGrid : QGraphicsRectItem
|
* *
|
||||||
|
* src/core/composer/qgspaperitem.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class QgsPaperGrid: QGraphicsRectItem
|
||||||
{
|
{
|
||||||
|
%Docstring
|
||||||
|
Item representing a grid. This is drawn separately to the underlying paper item since the grid needs to be
|
||||||
|
drawn above all other composer items, while the paper item is drawn below all others.*
|
||||||
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include <qgspaperitem.h>
|
#include "qgspaperitem.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
QgsPaperGrid( double x, double y, double width, double height, QgsComposition *composition );
|
QgsPaperGrid( double x, double y, double width, double height, QgsComposition *composition );
|
||||||
~QgsPaperGrid();
|
|
||||||
|
|
||||||
/** \brief Reimplementation of QCanvasItem::paint*/
|
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
|
||||||
void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
|
|
||||||
|
%Docstring
|
||||||
|
Reimplementation of QCanvasItem.paint
|
||||||
|
%End
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Item representing the paper.*/
|
|
||||||
class QgsPaperItem : QgsComposerItem
|
class QgsPaperItem : QgsComposerItem
|
||||||
{
|
{
|
||||||
|
%Docstring
|
||||||
|
Item representing the paper.*
|
||||||
|
%End
|
||||||
|
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include <qgspaperitem.h>
|
#include "qgspaperitem.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
QgsPaperItem( QgsComposition *c /TransferThis/ );
|
QgsPaperItem( QgsComposition *c /TransferThis/ );
|
||||||
QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition *composition /TransferThis/ );
|
QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition *composition /TransferThis/ );
|
||||||
~QgsPaperItem();
|
~QgsPaperItem();
|
||||||
|
|
||||||
/** Return correct graphics item type. */
|
|
||||||
virtual int type() const;
|
virtual int type() const;
|
||||||
|
%Docstring
|
||||||
|
Return correct graphics item type.
|
||||||
|
:rtype: int
|
||||||
|
%End
|
||||||
|
|
||||||
/** \brief Reimplementation of QCanvasItem::paint*/
|
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
|
||||||
void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
|
|
||||||
|
|
||||||
/** Stores state in Dom element
|
%Docstring
|
||||||
* @param elem is Dom element corresponding to 'Composer' tag
|
Reimplementation of QCanvasItem.paint
|
||||||
* @param doc Dom document
|
%End
|
||||||
*/
|
|
||||||
bool writeXml( QDomElement &elem, QDomDocument &doc ) const;
|
|
||||||
|
|
||||||
/** Sets state from Dom document
|
virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const;
|
||||||
* @param itemElem is Dom node corresponding to item tag
|
|
||||||
* @param doc is the Dom document
|
%Docstring
|
||||||
*/
|
Stores state in Dom element
|
||||||
bool readXml( const QDomElement &itemElem, const QDomDocument &doc );
|
\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 the Dom document
|
||||||
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
virtual void setSceneRect( const QRectF &rectangle );
|
virtual void setSceneRect( const QRectF &rectangle );
|
||||||
|
|
||||||
private:
|
|
||||||
QgsPaperItem();
|
|
||||||
/** Set flags and z-value*/
|
|
||||||
void initialize();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/composer/qgspaperitem.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
@ -448,6 +448,10 @@ while ($LINE_IDX < $LINE_COUNT){
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# skip friends
|
||||||
|
if ( $LINE =~ m/^\s*friend class \w+/ ){
|
||||||
|
next;
|
||||||
|
}
|
||||||
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET
|
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET
|
||||||
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED).*?$/){
|
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED).*?$/){
|
||||||
next;
|
next;
|
||||||
|
@ -863,7 +863,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
|||||||
* \since QGIS 3.0
|
* \since QGIS 3.0
|
||||||
* \see setDataDefinedProperties()
|
* \see setDataDefinedProperties()
|
||||||
*/
|
*/
|
||||||
const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; }
|
const QgsPropertyCollection &dataDefinedProperties() const { return mDataDefinedProperties; } SIP_SKIP
|
||||||
|
|
||||||
/** Sets the composition's property collection, used for data defined overrides.
|
/** Sets the composition's property collection, used for data defined overrides.
|
||||||
* \param collection property collection. Existing properties will be replaced.
|
* \param collection property collection. Existing properties will be replaced.
|
||||||
@ -1057,7 +1057,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
|||||||
friend class TestQgsComposition;
|
friend class TestQgsComposition;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T> void QgsComposition::composerItems( QList<T *> &itemList )
|
template<class T> void QgsComposition::composerItems( QList<T *> &itemList ) SIP_SKIP
|
||||||
{
|
{
|
||||||
itemList.clear();
|
itemList.clear();
|
||||||
QList<QGraphicsItem *> graphicsItemList = items();
|
QList<QGraphicsItem *> graphicsItemList = items();
|
||||||
@ -1072,7 +1072,7 @@ template<class T> void QgsComposition::composerItems( QList<T *> &itemList )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void QgsComposition::composerItemsOnPage( QList<T *> &itemList, const int pageNumber ) const
|
template<class T> void QgsComposition::composerItemsOnPage( QList<T *> &itemList, const int pageNumber ) const SIP_SKIP
|
||||||
{
|
{
|
||||||
itemList.clear();
|
itemList.clear();
|
||||||
QList<QGraphicsItem *> graphicsItemList = items();
|
QList<QGraphicsItem *> graphicsItemList = items();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user