| 
    QGIS API Documentation
    2.18.21-Las Palmas (9fba24a)
    
   | 
 
Utilities for compositions. More...
#include <qgscomposerutils.h>
Static Public Member Functions | |
| static double | angle (QPointF p1, QPointF p2) | 
| Calculates the angle of the line from p1 to p2 (counter clockwise, starting from a line from north to south)  More... | |
| static QgsComposition::PaperOrientation | decodePaperOrientation (const QString &orientationString, bool &ok) | 
| Decodes a string representing a paper orientation.  More... | |
| static bool | decodePresetPaperSize (const QString &presetString, double &width, double &height) | 
| Decodes a string representing a preset page size.  More... | |
| static void | drawArrowHead (QPainter *p, const double x, const double y, const double angle, const double arrowHeadWidth) | 
| Draws an arrow head on to a QPainter.  More... | |
| static void | drawText (QPainter *painter, QPointF pos, const QString &text, const QFont &font, const QColor &color=QColor()) | 
| 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)  More... | |
| 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) | 
| 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)  More... | |
| static double | fontAscentMM (const QFont &font) | 
| Calculate font ascent in millimeters, including workarounds for QT font rendering issues.  More... | |
| static double | fontDescentMM (const QFont &font) | 
| Calculate font descent in millimeters, including workarounds for QT font rendering issues.  More... | |
| static double | fontHeightCharacterMM (const QFont &font, QChar character) | 
| Calculate font height in millimeters of a single character, including workarounds for QT font rendering issues.  More... | |
| static double | fontHeightMM (const QFont &font) | 
| Calculate font height in millimeters, including workarounds for QT font rendering issues The font height is the font ascent + descent + 1 (for the baseline).  More... | |
| static QRectF | largestRotatedRectWithinBounds (const QRectF &originalRect, const QRectF &boundsRect, const double rotation) | 
| Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by a specified amount.  More... | |
| static double | mmToPoints (const double mmSize) | 
| Returns the size in mm corresponding to a font point size.  More... | |
| static double | normalizedAngle (const double angle) | 
| Ensures that an angle is in the range 0 <= angle < 360.  More... | |
| static double | pointsToMM (const double pointSize) | 
| Returns the size in mm corresponding to a font point size.  More... | |
| static void | readDataDefinedProperty (const QgsComposerObject::DataDefinedProperty property, const QDomElement &ddElem, QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined * > *dataDefinedProperties) | 
| Reads a single data defined property from xml DOM element.  More... | |
| static void | readDataDefinedPropertyMap (const QDomElement &itemElem, QMap< QgsComposerObject::DataDefinedProperty, QString > *dataDefinedNames, QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined * > *dataDefinedProperties) | 
| Reads all data defined properties from xml.  More... | |
| static double | relativePosition (const double position, const double beforeMin, const double beforeMax, const double afterMin, const double afterMax) | 
| Returns a scaled position given a before and after range.  More... | |
| static void | relativeResizeRect (QRectF &rectToResize, const QRectF &boundsBefore, const QRectF &boundsAfter) | 
| Resizes a QRectF relative to a resized bounding rectangle.  More... | |
| static void | rotate (const double angle, double &x, double &y) | 
| Rotates a point / vector around the origin.  More... | |
| static QFont | scaledFontPixelSize (const QFont &font) | 
| 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.  More... | |
| static double | snappedAngle (const double angle) | 
| Snaps an angle to its closest 45 degree angle.  More... | |
| static double | textHeightMM (const QFont &font, const QString &text, double multiLineHeight=1.0) | 
| Calculate font height in millimeters for a string, including workarounds for QT font rendering issues.  More... | |
| static double | textWidthMM (const QFont &font, const QString &text) | 
| Calculate font width in millimeters for a string, including workarounds for QT font rendering issues.  More... | |
| static void | writeDataDefinedPropertyMap (QDomElement &itemElem, QDomDocument &doc, const QMap< QgsComposerObject::DataDefinedProperty, QString > *dataDefinedNames, const QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined * > *dataDefinedProperties) | 
| Writes data defined properties to xml.  More... | |
Utilities for compositions.
Definition at line 29 of file qgscomposerutils.h.
Calculates the angle of the line from p1 to p2 (counter clockwise, starting from a line from north to south)
| p1 | start point of line | 
| p2 | end point of line | 
Definition at line 67 of file qgscomposerutils.cpp.
      
  | 
  static | 
Decodes a string representing a paper orientation.
| orientationString | string to decode | 
| ok | will be true if string could be decoded | 
Definition at line 262 of file qgscomposerutils.cpp.
      
  | 
  static | 
Decodes a string representing a preset page size.
| presetString | string to decode | 
| width | double for decoded paper width | 
| height | double for decoded paper height | 
Definition at line 278 of file qgscomposerutils.cpp.
      
  | 
  static | 
Draws an arrow head on to a QPainter.
| p | destination painter | 
| x | x-coordinate of arrow center | 
| y | y-coordinate of arrow center | 
| angle | angle in degrees which arrow should point toward, measured clockwise from pointing vertical upward | 
| arrowHeadWidth | size of arrow head | 
Definition at line 29 of file qgscomposerutils.cpp.
      
  | 
  static | 
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)
| painter | destination QPainter | 
| pos | position to draw text | 
| text | string to draw | 
| font | font to use for drawing text | 
| color | color to draw text | 
Definition at line 500 of file qgscomposerutils.cpp.
      
  | 
  static | 
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)
| painter | destination QPainter | 
| rect | rectangle to draw into | 
| text | string to draw | 
| font | font to use for drawing text | 
| color | color to draw text | 
| halignment | optional horizontal alignment | 
| valignment | optional vertical alignment | 
| flags | allows for passing Qt::TextFlags to control appearance of rendered text | 
Definition at line 523 of file qgscomposerutils.cpp.
      
  | 
  static | 
Calculate font ascent in millimeters, including workarounds for QT font rendering issues.
| font | input font | 
Definition at line 439 of file qgscomposerutils.cpp.
      
  | 
  static | 
Calculate font descent in millimeters, including workarounds for QT font rendering issues.
| font | input font | 
Definition at line 448 of file qgscomposerutils.cpp.
Calculate font height in millimeters of a single character, including workarounds for QT font rendering issues.
| font | input font | 
| character | character to calculate height for | 
Definition at line 466 of file qgscomposerutils.cpp.
      
  | 
  static | 
Calculate font height in millimeters, including workarounds for QT font rendering issues The font height is the font ascent + descent + 1 (for the baseline).
| font | input font | 
Definition at line 457 of file qgscomposerutils.cpp.
      
  | 
  static | 
Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by a specified amount.
| originalRect | QRectF to be rotated and scaled | 
| boundsRect | QRectF specifying the bounds which the rotated and scaled rectangle must fit within | 
| rotation | the rotation in degrees to be applied to the rectangle | 
Definition at line 149 of file qgscomposerutils.cpp.
      
  | 
  static | 
Returns the size in mm corresponding to a font point size.
| mmSize | font size in mm | 
Definition at line 235 of file qgscomposerutils.cpp.
      
  | 
  static | 
Ensures that an angle is in the range 0 <= angle < 360.
| angle | angle in degrees | 
Definition at line 95 of file qgscomposerutils.cpp.
      
  | 
  static | 
Returns the size in mm corresponding to a font point size.
| pointSize | font size in points | 
Definition at line 229 of file qgscomposerutils.cpp.
      
  | 
  static | 
Reads a single data defined property from xml DOM element.
| property | data defined property to read | 
| ddElem | dom element containing settings for data defined property | 
| dataDefinedProperties | map of data defined properties to QgsDataDefined in which to store properties from xml | 
Definition at line 336 of file qgscomposerutils.cpp.
      
  | 
  static | 
Reads all data defined properties from xml.
| itemElem | dom element containing data defined properties | 
| dataDefinedNames | map of data defined property to name used within xml | 
| dataDefinedProperties | map of data defined properties to QgsDataDefined in which to store properties from xml | 
Definition at line 321 of file qgscomposerutils.cpp.
      
  | 
  static | 
Returns a scaled position given a before and after range.
| position | initial position within before range to scale | 
| beforeMin | minimum value in before range | 
| beforeMax | maximum value in before range | 
| afterMin | minimum value in after range | 
| afterMax | maximum value in after range | 
Definition at line 252 of file qgscomposerutils.cpp.
      
  | 
  static | 
Resizes a QRectF relative to a resized bounding rectangle.
| rectToResize | QRectF to resize, contained within boundsBefore. The rectangle is linearly scaled to retain its relative position and size within boundsAfter. | 
| boundsBefore | QRectF of bounds before resize | 
| boundsAfter | QRectF of bounds after resize | 
Definition at line 241 of file qgscomposerutils.cpp.
      
  | 
  static | 
Rotates a point / vector around the origin.
| angle | rotation angle in degrees, counterclockwise | 
| x | in/out: x coordinate before / after the rotation | 
| y | in/out: y cooreinate before / after the rotation | 
Definition at line 85 of file qgscomposerutils.cpp.
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.
| font | source font with size set in points | 
Definition at line 429 of file qgscomposerutils.cpp.
      
  | 
  static | 
Snaps an angle to its closest 45 degree angle.
| angle | angle in degrees | 
Definition at line 109 of file qgscomposerutils.cpp.
      
  | 
  static | 
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.
| font | input font | 
| text | string to calculate height of | 
| multiLineHeight | line spacing factor | 
Definition at line 484 of file qgscomposerutils.cpp.
Calculate font width in millimeters for a string, including workarounds for QT font rendering issues.
| font | input font | 
| text | string to calculate width of | 
Definition at line 475 of file qgscomposerutils.cpp.
      
  | 
  static | 
Writes data defined properties to xml.
| itemElem | DOM element in which to store data defined properties | 
| doc | DOM document | 
| dataDefinedNames | map of data defined property to name used within xml | 
| dataDefinedProperties | map of data defined properties to QgsDataDefined for storing in xml | 
Definition at line 381 of file qgscomposerutils.cpp.
 1.8.13