QGIS API Documentation  3.2.0-Bonn (bc43194)
Public Member Functions | Properties | List of all members
QgsQuickUtils Class Reference

Encapsulating the common utilies for QgsQuick library. More...

#include <qgsquickutils.h>

Inheritance diagram for QgsQuickUtils:
Inheritance graph
[legend]

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...
 

Detailed Description

Encapsulating the common utilies for QgsQuick library.

Note
QML Type: Utils (Singleton)
Since
QGIS 3.2

Definition at line 40 of file qgsquickutils.h.

Constructor & Destructor Documentation

◆ QgsQuickUtils()

QgsQuickUtils::QgsQuickUtils ( QObject *  parent = nullptr)

Create new utilities.

Definition at line 27 of file qgsquickutils.cpp.

◆ ~QgsQuickUtils()

QgsQuickUtils::~QgsQuickUtils ( )
default

dtor

Member Function Documentation

◆ dumpScreenInfo()

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.

◆ logMessage()

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.

◆ screenDensity()

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.

◆ screenUnitsToMeters()

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.

Property Documentation

◆ dp

qreal QgsQuickUtils::dp
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.


The documentation for this class was generated from the following files: