QGIS API Documentation
3.6.0-Noosa (5873452)
|
Encapsulating the common utilies for QgsQuick library. More...
#include <qgsquickutils.h>
Public Member Functions | |
QgsQuickUtils (QObject *parent=nullptr) | |
Create new utilities. More... | |
~QgsQuickUtils ()=default | |
Destructor. More... | |
QString | dumpScreenInfo () const |
Returns a string with information about screen size and resolution - useful for debugging. More... | |
qreal | screenDensity () const |
"dp" is useful for building building components that work well with different screen densities. More... | |
Static Public Member Functions | |
static Q_INVOKABLE QgsCoordinateReferenceSystem | coordinateReferenceSystemFromEpsgId (long epsg) |
Creates crs from epsg code in QML. More... | |
static Q_INVOKABLE QgsPoint | coordinateToPoint (const QGeoCoordinate &coor) |
Converts QGeoCoordinate to QgsPoint. More... | |
static Q_INVOKABLE QgsQuickFeatureLayerPair | featureFactory (const QgsFeature &feature, QgsVectorLayer *layer=nullptr) |
QgsQuickFeatureLayerPair factory for tuple of QgsFeature and QgsVectorLayer used in QgsQUick library. More... | |
static Q_INVOKABLE bool | fileExists (const QString &path) |
Returns whether file on path exists. More... | |
static Q_INVOKABLE QString | formatDistance (double distance, QgsUnitTypes::DistanceUnit units, int decimals, QgsUnitTypes::SystemOfMeasurement destSystem=QgsUnitTypes::MetricSystem) |
Converts distance to human readable distance. More... | |
static Q_INVOKABLE QString | formatPoint (const QgsPoint &point, QgsCoordinateFormatter::Format format=QgsCoordinateFormatter::FormatPair, int decimals=3, QgsCoordinateFormatter::FormatFlags flags=QgsCoordinateFormatter::FlagDegreesUseStringSuffix) |
Formats a point according to the specified parameters. More... | |
static Q_INVOKABLE const QUrl | getEditorComponentSource (const QString &widgetName) |
Returns url to field editor component for a feature form. More... | |
static Q_INVOKABLE QString | getFileName (const QString &path) |
Extracts filename from path. More... | |
static Q_INVOKABLE const QUrl | getThemeIcon (const QString &name) |
Returns QUrl to image from library's /images folder. More... | |
static void | humanReadableDistance (double srcDistance, QgsUnitTypes::DistanceUnit srcUnits, QgsUnitTypes::SystemOfMeasurement destSystem, double &destDistance, QgsUnitTypes::DistanceUnit &destUnits) |
Converts distance to human readable distance in destination system of measurement. More... | |
static Q_INVOKABLE void | logMessage (const QString &message, const QString &tag=QString("QgsQuick"), Qgis::MessageLevel level=Qgis::Warning) |
Log message in QgsMessageLog. More... | |
static Q_INVOKABLE QgsPoint | point (double x, double y, double z=std::numeric_limits< double >::quiet_NaN(), double m=std::numeric_limits< double >::quiet_NaN()) |
Creates QgsPoint in QML. More... | |
static Q_INVOKABLE QgsPointXY | pointXY (double x, double y) |
Creates QgsPointXY in QML. More... | |
static Q_INVOKABLE double | screenUnitsToMeters (QgsQuickMapSettings *mapSettings, int baseLengthPixels) |
Calculates the distance in meter representing baseLengthPixels pixels on the screen based on the current map settings. More... | |
static Q_INVOKABLE QgsPointXY | transformPoint (const QgsCoordinateReferenceSystem &srcCrs, const QgsCoordinateReferenceSystem &destCrs, const QgsCoordinateTransformContext &context, const QgsPointXY &srcPoint) |
Transforms point between different crs from QML. More... | |
Properties | |
qreal | dp |
"dp" is useful for building building components that work well with different screen densities. More... | |
Encapsulating the common utilies for QgsQuick library.
Definition at line 51 of file qgsquickutils.h.
QgsQuickUtils::QgsQuickUtils | ( | QObject * | parent = nullptr | ) |
Create new utilities.
Definition at line 35 of file qgsquickutils.cpp.
|
default |
Destructor.
|
static |
Creates crs from epsg code in QML.
Makes QgsCoordinateReferenceSystem::fromEpsgId accessible for QML components.
Definition at line 44 of file qgsquickutils.cpp.
|
static |
QString QgsQuickUtils::dumpScreenInfo | ( | ) | const |
Returns a string with information about screen size and resolution - useful for debugging.
Definition at line 297 of file qgsquickutils.cpp.
|
static |
QgsQuickFeatureLayerPair factory for tuple of QgsFeature and QgsVectorLayer used in QgsQUick library.
feature | QgsFeature linked to new QgsQuickFeature instance. |
layer | QgsVectorLayer which the feature belongs to, optional. |
Definition at line 110 of file qgsquickutils.cpp.
|
static |
|
static |
Converts distance to human readable distance.
This is useful for scalebar texts or output of the GPS accuracy
The resulting units are determined automatically, based on requested system of measurement. e.g. 1222.234 m is converted to 1.2 km
distance | distance in units |
units | units of dist |
decimals | decimal to use |
destSystem | system of measurement of the result |
Definition at line 150 of file qgsquickutils.cpp.
|
static |
Formats a point according to the specified parameters.
The format argument indicates the desired display format for the coordinate.
The precision argument gives the number of decimal places to include for coordinates.
Optional flags can be specified to control the output format.
Definition at line 141 of file qgsquickutils.cpp.
|
static |
Returns url to field editor component for a feature form.
If the widgetName does not match any supported widget, text edit is returned.
widgetName | name of the attribute field widget |
Definition at line 122 of file qgsquickutils.cpp.
|
static |
|
static |
Returns QUrl to image from library's /images folder.
Definition at line 115 of file qgsquickutils.cpp.
|
static |
Converts distance to human readable distance in destination system of measurement.
srcDistance | distance in units |
srcUnits | units of dist |
destSystem | system of measurement of the result |
destDistance | output: distance if desired system of measurement |
destUnits | output: unit of destDistance |
Definition at line 166 of file qgsquickutils.cpp.
|
static |
Log message in QgsMessageLog.
Definition at line 105 of file qgsquickutils.cpp.
|
static |
|
static |
qreal QgsQuickUtils::screenDensity | ( | ) | const |
"dp" is useful for building building components that work well with different screen densities.
It stands for density-independent pixels. A width of 10dp is going to be the same physical size on all screens regardless their density. In QML code, all values are specified in screen pixels, so in order to set a width of 10dp, one would use the following code: "width: 10 * QgsQuick.Utils.dp"
1dp is approximately 0.16mm. When screen has 160 DPI (baseline), the value of "dp" is 1. On high DPI screen the value will be greater, e.g. 1.5.
This is a readonly property.
Definition at line 315 of file qgsquickutils.cpp.
|
static |
Calculates the distance in meter representing baseLengthPixels pixels on the screen based on the current map settings.
Definition at line 74 of file qgsquickutils.cpp.
|
static |
Transforms point between different crs from QML.
Definition at line 64 of file qgsquickutils.cpp.
|
read |
"dp" is useful for building building components that work well with different screen densities.
It stands for density-independent pixels. A width of 10dp is going to be the same physical size on all screens regardless their density. In QML code, all values are specified in screen pixels, so in order to set a width of 10dp, one would use the following code: "width: 10 * QgsQuick.Utils.dp"
1dp is approximately 0.16mm. When screen has 160 DPI (baseline), the value of "dp" is 1. On high DPI screen the value will be greater, e.g. 1.5.
This is a readonly property.
Definition at line 66 of file qgsquickutils.h.