Helpers QML Type
Helper functions for building graphs. More...
| Import Statement: | import QuickGraphLib |
Methods
- rect boundingRect(var points)
- rect clampedResizeRect(point position, point anchor, real minimumWidth, real minimumHeight, int xSign, int ySign)
- real distanceToSegment(point point, point segmentStart, point segmentEnd)
- QPicture exportToPicture(Item obj)
- bool exportToPng(Item obj, url path, int dpi)
- bool exportToSvg(Item obj, url path)
- bool isInsideEllipse(point point, point center, real radiusX, real radiusY)
- bool isInsidePolygon(point point, var points)
- bool isNearPolyline(point point, var points, real hitWidth, bool closed)
- bool isNearSegment(point point, point segmentStart, point segmentEnd, real hitWidth)
- list<real> linspace(real min, real max, int num)
- list<real> logspace(real logmin, real logmax, int num, real base)
- QPolygonF mapPoints(var points, matrix4x4 dataTransform)
- rect normalizedRect(rect rect)
- list<int> range(int min, int max, int step)
- list<real> tickLocator(real min, real max, int maxNum)
Detailed Description
Method Documentation
Returns a normalized rectangle between anchor and position. The position is clamped to preserve the non-negative minimumWidth and minimumHeight in the directions indicated by xSign and ySign.
Returns the shortest distance from point to the line segment from segmentStart to segmentEnd.
QPicture exportToPicture(Item obj) |
Exports the graph in obj to a QPicture.
Note: Only some QML elements are supported by this export method (e.g. Rectangle, PathPolyline). Other elements will be rendered incorrectly or not at all. See QPainter-based export for more information.
Note: Using this method, followed by saving to an image should give the same result as the other functions (ignoring some differences in the output that result in equivalent display). One exception is that exporting an ImageView as SVG will result in images rendering using the "optimiseSpeed" setting when they are not smooth. For reliable rendering across multiple programs, it is better to replace this with "pixelated". Helpers::exportToSvg does this correction automatically.
See also Helpers::exportToPng, Helpers::exportToSvg, and Exporting graphs.
Exports the graph in obj to an PNG file at path with the resolution dpi. Returns a boolean indicating success.
Note: Only some QML elements are supported by this export method (e.g. Rectangle, PathPolyline). Other elements will be rendered incorrectly or not at all. See QPainter-based export for more information.
See also Helpers::exportToSvg, Helpers::exportToPicture, and Exporting graphs.
Exports the graph in obj to an SVG file at path. Returns a boolean indicating success.
Note: Only some QML elements are supported by this export method (e.g. Rectangle, PathPolyline). Other elements will be rendered incorrectly or not at all. See QPainter-based export for more information.
See also Helpers::exportToPng, Helpers::exportToPicture, and Exporting graphs.
Returns whether point is inside the ellipse centered on center with radii radiusX and radiusY.
Returns whether point is inside the polygon defined by points.
Returns whether point is within half hitWidth of any segment in points. If closed is true, the final point is connected back to the first point.
Returns whether point is within half hitWidth of the segment from segmentStart to segmentEnd.
Returns a list of num values equally spaced from min and max (inclusive).
Returns a list of num values equally spaced from base to the power of logmin and base to the power of logmax (inclusive).
Maps each point in points though the transform defined by dataTransform. Essentially the same as points.map(p => dataTransform.map(p)), but more efficient.
Returns a list of values from min to max (exclusive) with a gap of step between each one.
Returns a list of at most maxNum nice tick locations values equally spaced between min and max.