QGIS API Documentation
3.2.0-Bonn (bc43194)
|
Encapsulating the common utilies for QgsQuick library. More...
#include <qgsquickutils.h>
Public Member Functions | |
QgsQuickUtils (QObject *parent=nullptr) | |
Create new utilities. More... | |
~QgsQuickUtils ()=default | |
dtor More... | |
QString | dumpScreenInfo () const |
Returns a string with information about screen size and resolution. More... | |
Q_INVOKABLE void | logMessage (const QString &message, const QString &tag=QString("QgsQuick"), Qgis::MessageLevel level=Qgis::Warning) |
Log message in QgsMessageLog. More... | |
qreal | screenDensity () const |
"dp" is useful for building building components that work well with different screen densities. More... | |
Q_INVOKABLE double | screenUnitsToMeters (QgsQuickMapSettings *mapSettings, int baseLengthPixels) const |
Calculate the distance in meter representing baseLengthPixels pixels on the screen based on the current map settings. 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 40 of file qgsquickutils.h.
QgsQuickUtils::QgsQuickUtils | ( | QObject * | parent = nullptr | ) |
Create new utilities.
Definition at line 27 of file qgsquickutils.cpp.
|
default |
dtor
QString QgsQuickUtils::dumpScreenInfo | ( | ) | const |
Returns a string with information about screen size and resolution.
Useful to log for debugging of graphical problems on various display sizes
Definition at line 55 of file qgsquickutils.cpp.
void QgsQuickUtils::logMessage | ( | const QString & | message, |
const QString & | tag = QString( "QgsQuick" ) , |
||
Qgis::MessageLevel | level = Qgis::Warning |
||
) |
Log message in QgsMessageLog.
Definition at line 50 of file qgsquickutils.cpp.
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 73 of file qgsquickutils.cpp.
double QgsQuickUtils::screenUnitsToMeters | ( | QgsQuickMapSettings * | mapSettings, |
int | baseLengthPixels | ||
) | const |
Calculate the distance in meter representing baseLengthPixels pixels on the screen based on the current map settings.
Definition at line 33 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 55 of file qgsquickutils.h.