Helpers QML Type

Helper functions for building graphs. More...

Import Statement: import QuickGraphLib

Methods

Detailed Description

Method Documentation

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.


void exportToPng(Item obj, url path, int dpi = 96 * 2)

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.


bool exportToSvg(Item obj, url path)

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.

Note: Clip paths for SVGs are only supported in Qt 6.7+. If your graph needs clipping, ensure you are using a Qt version that supports it.

See also Helpers::exportToPng, Helpers::exportToPicture, and Exporting graphs.


list<real> linspace(real min, real max, int num)

Returns a list of num values equally spaced from min and max (inclusive).


QPolygonF mapPoints(var points, matrix4x4 dataTransform)

Maps each point in points though the transform defined by dataTransform. Essentially the same as points.map(p => dataTransform.map(p)), but more efficient.


list<int> range(int min, int max, int step = 1)

Returns a list of values from min to max (exclusive) with a gap of step between each one.


list<real> tickLocator(real min, real max, int maxNum)

Returns a list of at most maxNum nice tick locations values equally spaced between min and max.